MM-21357: Use typed constant for channel types (#17928)
* MM-21357: Use typed constant for channel types https://mattermost.atlassian.net/browse/MM-21357 ```release-note - Introduced a new type ChannelType for all channel types. - Updated the Client4.UpdateChannelPrivacy method to ChannelType. ``` * Address review comments ```release-note NONE ``` * telemetry fix ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
Claudio Costa
родитель
4968657651
Коммит
da7d71ccf7
@@ -17,15 +17,15 @@ import (
|
||||
|
||||
// channelInviteMsg represents an invitation for a remote cluster to start sharing a channel.
|
||||
type channelInviteMsg struct {
|
||||
ChannelId string `json:"channel_id"`
|
||||
TeamId string `json:"team_id"`
|
||||
ReadOnly bool `json:"read_only"`
|
||||
Name string `json:"name"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Header string `json:"header"`
|
||||
Purpose string `json:"purpose"`
|
||||
Type string `json:"type"`
|
||||
DirectParticipantIDs []string `json:"direct_participant_ids"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
TeamId string `json:"team_id"`
|
||||
ReadOnly bool `json:"read_only"`
|
||||
Name string `json:"name"`
|
||||
DisplayName string `json:"display_name"`
|
||||
Header string `json:"header"`
|
||||
Purpose string `json:"purpose"`
|
||||
Type model.ChannelType `json:"type"`
|
||||
DirectParticipantIDs []string `json:"direct_participant_ids"`
|
||||
}
|
||||
|
||||
type InviteOption func(msg *channelInviteMsg)
|
||||
|
||||
@@ -7,10 +7,11 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
"github.com/mattermost/mattermost-server/v5/shared/mlog"
|
||||
)
|
||||
|
||||
func slackParseChannels(data io.Reader, channelType string) ([]slackChannel, error) {
|
||||
func slackParseChannels(data io.Reader, channelType model.ChannelType) ([]slackChannel, error) {
|
||||
decoder := json.NewDecoder(data)
|
||||
|
||||
var channels []slackChannel
|
||||
|
||||
@@ -31,7 +31,7 @@ type slackChannel struct {
|
||||
Members []string `json:"members"`
|
||||
Purpose slackChannelSub `json:"purpose"`
|
||||
Topic slackChannelSub `json:"topic"`
|
||||
Type string
|
||||
Type model.ChannelType
|
||||
}
|
||||
|
||||
type slackChannelSub struct {
|
||||
|
||||
@@ -101,9 +101,9 @@ func initializeMocks(cfg *model.Config) (*mocks.ServerIface, *storeMocks.Store,
|
||||
teamStore.On("GroupSyncedTeamCount").Return(int64(16), nil)
|
||||
|
||||
channelStore := storeMocks.ChannelStore{}
|
||||
channelStore.On("AnalyticsTypeCount", "", "O").Return(int64(25), nil)
|
||||
channelStore.On("AnalyticsTypeCount", "", "P").Return(int64(26), nil)
|
||||
channelStore.On("AnalyticsTypeCount", "", "D").Return(int64(27), nil)
|
||||
channelStore.On("AnalyticsTypeCount", "", model.ChannelTypeOpen).Return(int64(25), nil)
|
||||
channelStore.On("AnalyticsTypeCount", "", model.ChannelTypePrivate).Return(int64(26), nil)
|
||||
channelStore.On("AnalyticsTypeCount", "", model.ChannelTypeDirect).Return(int64(27), nil)
|
||||
channelStore.On("AnalyticsDeletedTypeCount", "", "O").Return(int64(22), nil)
|
||||
channelStore.On("AnalyticsDeletedTypeCount", "", "P").Return(int64(23), nil)
|
||||
channelStore.On("GroupSyncedChannelCount").Return(int64(17), nil)
|
||||
|
||||
Ссылка в новой задаче
Block a user