[MM-16751] golint model (#17896)
Этот коммит содержится в:
коммит произвёл
Claudio Costa
родитель
953eebdef4
Коммит
97ccf0bdf6
@@ -181,14 +181,14 @@ func (job *EmailBatchingJob) checkPendingNotifications(now time.Time, handler fu
|
||||
|
||||
// get how long we need to wait to send notifications to the user
|
||||
var interval int64
|
||||
preference, err := job.service.store.Preference().Get(userID, model.PREFERENCE_CATEGORY_NOTIFICATIONS, model.PREFERENCE_NAME_EMAIL_INTERVAL)
|
||||
preference, err := job.service.store.Preference().Get(userID, model.PreferenceCategoryNotifications, model.PreferenceNameEmailInterval)
|
||||
if err != nil {
|
||||
// use the default batching interval if an error ocurrs while fetching user preferences
|
||||
interval, _ = strconv.ParseInt(model.PREFERENCE_EMAIL_INTERVAL_BATCHING_SECONDS, 10, 64)
|
||||
interval, _ = strconv.ParseInt(model.PreferenceEmailIntervalBatchingSeconds, 10, 64)
|
||||
} else {
|
||||
if value, err := strconv.ParseInt(preference.Value, 10, 64); err != nil {
|
||||
// // use the default batching interval if an error ocurrs while deserializing user preferences
|
||||
interval, _ = strconv.ParseInt(model.PREFERENCE_EMAIL_INTERVAL_BATCHING_SECONDS, 10, 64)
|
||||
interval, _ = strconv.ParseInt(model.PreferenceEmailIntervalBatchingSeconds, 10, 64)
|
||||
} else {
|
||||
interval = value
|
||||
}
|
||||
@@ -220,12 +220,12 @@ func (es *Service) sendBatchedEmailNotification(userID string, notifications []*
|
||||
postsData := make([]*postData, 0 /* len */, len(notifications) /* cap */)
|
||||
embeddedFiles := make(map[string]io.Reader)
|
||||
|
||||
emailNotificationContentsType := model.EMAIL_NOTIFICATION_CONTENTS_FULL
|
||||
emailNotificationContentsType := model.EmailNotificationContentsFull
|
||||
if license := es.license(); license != nil && *license.Features.EmailNotificationContents {
|
||||
emailNotificationContentsType = *es.config().EmailSettings.EmailNotificationContentsType
|
||||
}
|
||||
|
||||
if emailNotificationContentsType == model.EMAIL_NOTIFICATION_CONTENTS_FULL {
|
||||
if emailNotificationContentsType == model.EmailNotificationContentsFull {
|
||||
for i, notification := range notifications {
|
||||
sender, errSender := es.userService.GetUser(notification.post.UserId)
|
||||
if errSender != nil {
|
||||
|
||||
@@ -98,8 +98,8 @@ func TestCheckPendingNotifications(t *testing.T) {
|
||||
|
||||
nErr := th.store.Preference().Save(&model.Preferences{{
|
||||
UserId: th.BasicUser.Id,
|
||||
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
|
||||
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
|
||||
Category: model.PreferenceCategoryNotifications,
|
||||
Name: model.PreferenceNameEmailInterval,
|
||||
Value: "60",
|
||||
}})
|
||||
require.NoError(t, nErr)
|
||||
@@ -120,8 +120,8 @@ func TestCheckPendingNotifications(t *testing.T) {
|
||||
// We reset the interval to something shorter
|
||||
nErr = th.store.Preference().Save(&model.Preferences{{
|
||||
UserId: th.BasicUser.Id,
|
||||
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
|
||||
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
|
||||
Category: model.PreferenceCategoryNotifications,
|
||||
Name: model.PreferenceNameEmailInterval,
|
||||
Value: "10",
|
||||
}})
|
||||
require.NoError(t, nErr)
|
||||
@@ -256,8 +256,8 @@ func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
|
||||
// preference value is not an integer, so we'll fall back to the default 15min value
|
||||
nErr := th.store.Preference().Save(&model.Preferences{{
|
||||
UserId: th.BasicUser.Id,
|
||||
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
|
||||
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
|
||||
Category: model.PreferenceCategoryNotifications,
|
||||
Name: model.PreferenceNameEmailInterval,
|
||||
Value: "notAnIntegerValue",
|
||||
}})
|
||||
require.NoError(t, nErr)
|
||||
|
||||
@@ -54,7 +54,7 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
th := setupTestHelper(mockStore, tb)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.STATUS_ONLINE}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
statusMock.On("UpdateLastActivityAt", "user1", mock.Anything).Return(nil)
|
||||
statusMock.On("SaveOrUpdate", mock.AnythingOfType("*model.Status")).Return(nil)
|
||||
emptyMockStore := mocks.Store{}
|
||||
@@ -155,7 +155,7 @@ func (th *TestHelper) InitBasic() *TestHelper {
|
||||
th.BasicUser2, _ = th.service.userService.GetUser(th.BasicUser2.Id)
|
||||
th.addUserToTeam(th.BasicTeam, th.BasicUser2)
|
||||
|
||||
th.BasicChannel = th.createChannel(th.BasicTeam, model.CHANNEL_OPEN)
|
||||
th.BasicChannel = th.createChannel(th.BasicTeam, model.ChannelTypeOpen)
|
||||
th.addUserToChannel(th.BasicChannel, th.SystemAdminUser)
|
||||
th.addUserToChannel(th.BasicChannel, th.BasicUser)
|
||||
th.addUserToChannel(th.BasicChannel, th.BasicUser2)
|
||||
@@ -169,7 +169,7 @@ func (th *TestHelper) CreateTeam() *model.Team {
|
||||
DisplayName: "dn_" + id,
|
||||
Name: "name" + id,
|
||||
Email: "success+" + id + "@simulator.amazonses.com",
|
||||
Type: model.TEAM_OPEN,
|
||||
Type: model.TeamOpen,
|
||||
}
|
||||
|
||||
utils.DisableDebugLogForTest()
|
||||
|
||||
Ссылка в новой задаче
Block a user