[GH-19150] Remove strings in all channel types for constants (#19535)
Automatic Merge
Этот коммит содержится в:
@@ -200,7 +200,7 @@ func (worker *BleveIndexerWorker) DoJob(job *model.Job) {
|
||||
}
|
||||
|
||||
// Same possible fail as above can happen when counting channels
|
||||
if count, err := worker.jobServer.Store.Channel().AnalyticsTypeCount("", "O"); err != nil {
|
||||
if count, err := worker.jobServer.Store.Channel().AnalyticsTypeCount("", model.ChannelTypeOpen); err != nil {
|
||||
mlog.Warn("Worker: Failed to fetch total channel count for job. An estimated value will be used for progress reporting.", mlog.String("workername", worker.name), mlog.String("job_id", job.Id), mlog.Err(err))
|
||||
progress.TotalChannelsCount = EstimatedChannelCount
|
||||
} else {
|
||||
|
||||
@@ -117,7 +117,7 @@ func TestSlackParseChannels(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer file.Close()
|
||||
|
||||
channels, err := slackParseChannels(file, "O")
|
||||
channels, err := slackParseChannels(file, model.ChannelTypeOpen)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 6, len(channels))
|
||||
}
|
||||
@@ -127,7 +127,7 @@ func TestSlackParseDirectMessages(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer file.Close()
|
||||
|
||||
channels, err := slackParseChannels(file, "D")
|
||||
channels, err := slackParseChannels(file, model.ChannelTypeDirect)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 4, len(channels))
|
||||
}
|
||||
@@ -137,7 +137,7 @@ func TestSlackParsePrivateChannels(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer file.Close()
|
||||
|
||||
channels, err := slackParseChannels(file, "P")
|
||||
channels, err := slackParseChannels(file, model.ChannelTypePrivate)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(channels))
|
||||
}
|
||||
@@ -147,7 +147,7 @@ func TestSlackParseGroupDirectMessages(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
defer file.Close()
|
||||
|
||||
channels, err := slackParseChannels(file, "G")
|
||||
channels, err := slackParseChannels(file, model.ChannelTypeGroup)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 3, len(channels))
|
||||
}
|
||||
@@ -327,7 +327,7 @@ func TestOldImportChannel(t *testing.T) {
|
||||
config.SetDefaults()
|
||||
|
||||
t.Run("No panic on direct channel", func(t *testing.T) {
|
||||
//ch := th.CreateDmChannel(u1)
|
||||
// ch := th.CreateDmChannel(u1)
|
||||
ch := &model.Channel{
|
||||
Type: model.ChannelTypeDirect,
|
||||
Name: "test-channel",
|
||||
|
||||
@@ -277,23 +277,23 @@ func (ts *TelemetryService) trackActivity() {
|
||||
mlog.Info("Could not get team count", mlog.Err(err))
|
||||
}
|
||||
|
||||
if ucc, err := ts.dbStore.Channel().AnalyticsTypeCount("", "O"); err == nil {
|
||||
if ucc, err := ts.dbStore.Channel().AnalyticsTypeCount("", model.ChannelTypeOpen); err == nil {
|
||||
publicChannelCount = ucc
|
||||
}
|
||||
|
||||
if pcc, err := ts.dbStore.Channel().AnalyticsTypeCount("", "P"); err == nil {
|
||||
if pcc, err := ts.dbStore.Channel().AnalyticsTypeCount("", model.ChannelTypePrivate); err == nil {
|
||||
privateChannelCount = pcc
|
||||
}
|
||||
|
||||
if dcc, err := ts.dbStore.Channel().AnalyticsTypeCount("", "D"); err == nil {
|
||||
if dcc, err := ts.dbStore.Channel().AnalyticsTypeCount("", model.ChannelTypeDirect); err == nil {
|
||||
directChannelCount = dcc
|
||||
}
|
||||
|
||||
if duccr, err := ts.dbStore.Channel().AnalyticsDeletedTypeCount("", "O"); err == nil {
|
||||
if duccr, err := ts.dbStore.Channel().AnalyticsDeletedTypeCount("", model.ChannelTypeOpen); err == nil {
|
||||
deletedPublicChannelCount = duccr
|
||||
}
|
||||
|
||||
if dpccr, err := ts.dbStore.Channel().AnalyticsDeletedTypeCount("", "P"); err == nil {
|
||||
if dpccr, err := ts.dbStore.Channel().AnalyticsDeletedTypeCount("", model.ChannelTypePrivate); err == nil {
|
||||
deletedPrivateChannelCount = dpccr
|
||||
}
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ func initializeMocks(cfg *model.Config) (*mocks.ServerIface, *storeMocks.Store,
|
||||
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("AnalyticsDeletedTypeCount", "", model.ChannelTypeOpen).Return(int64(22), nil)
|
||||
channelStore.On("AnalyticsDeletedTypeCount", "", model.ChannelTypePrivate).Return(int64(23), nil)
|
||||
channelStore.On("GroupSyncedChannelCount").Return(int64(17), nil)
|
||||
|
||||
postStore := storeMocks.PostStore{}
|
||||
|
||||
Ссылка в новой задаче
Block a user