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
@@ -357,11 +357,12 @@ func TestImportValidateTeamImportData(t *testing.T) {
|
||||
func TestImportValidateChannelImportData(t *testing.T) {
|
||||
|
||||
// Test with minimum required valid properties.
|
||||
chanTypeOpen := model.ChannelTypeOpen
|
||||
data := ChannelImportData{
|
||||
Team: ptrStr("teamname"),
|
||||
Name: ptrStr("channelname"),
|
||||
DisplayName: ptrStr("Display Name"),
|
||||
Type: ptrStr("O"),
|
||||
Type: &chanTypeOpen,
|
||||
}
|
||||
err := validateChannelImportData(&data)
|
||||
require.Nil(t, err, "Validation failed but should have been valid.")
|
||||
@@ -370,7 +371,7 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
||||
data = ChannelImportData{
|
||||
Name: ptrStr("channelname"),
|
||||
DisplayName: ptrStr("Display Name"),
|
||||
Type: ptrStr("O"),
|
||||
Type: &chanTypeOpen,
|
||||
}
|
||||
err = validateChannelImportData(&data)
|
||||
require.NotNil(t, err, "Should have failed due to missing team.")
|
||||
@@ -379,7 +380,7 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
||||
data = ChannelImportData{
|
||||
Team: ptrStr("teamname"),
|
||||
DisplayName: ptrStr("Display Name"),
|
||||
Type: ptrStr("O"),
|
||||
Type: &chanTypeOpen,
|
||||
}
|
||||
err = validateChannelImportData(&data)
|
||||
require.NotNil(t, err, "Should have failed due to missing name.")
|
||||
@@ -400,7 +401,7 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
||||
data = ChannelImportData{
|
||||
Team: ptrStr("teamname"),
|
||||
Name: ptrStr("channelname"),
|
||||
Type: ptrStr("O"),
|
||||
Type: &chanTypeOpen,
|
||||
}
|
||||
err = validateChannelImportData(&data)
|
||||
require.NotNil(t, err, "Should have failed due to missing display_name.")
|
||||
@@ -422,11 +423,13 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
||||
err = validateChannelImportData(&data)
|
||||
require.NotNil(t, err, "Should have failed due to missing type.")
|
||||
|
||||
data.Type = ptrStr("A")
|
||||
invalidType := model.ChannelType("A")
|
||||
data.Type = &invalidType
|
||||
err = validateChannelImportData(&data)
|
||||
require.NotNil(t, err, "Should have failed due to invalid type.")
|
||||
|
||||
data.Type = ptrStr("P")
|
||||
chanTypePr := model.ChannelTypePrivate
|
||||
data.Type = &chanTypePr
|
||||
err = validateChannelImportData(&data)
|
||||
require.Nil(t, err, "Should have succeeded with valid type.")
|
||||
|
||||
@@ -435,7 +438,7 @@ func TestImportValidateChannelImportData(t *testing.T) {
|
||||
Team: ptrStr("teamname"),
|
||||
Name: ptrStr("channelname"),
|
||||
DisplayName: ptrStr("Display Name"),
|
||||
Type: ptrStr("O"),
|
||||
Type: &chanTypeOpen,
|
||||
Header: ptrStr("Channel Header Here"),
|
||||
Purpose: ptrStr("Channel Purpose Here"),
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user