MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)
* Generate and use an interface instead of *App
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
66fc096768
Коммит
17523fa5d9
@@ -88,13 +88,13 @@ func TestCheckPendingNotifications(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
channelMember, err := th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
channelMember, err := th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
channelMember.LastViewedAt = 9999999
|
||||
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
|
||||
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
|
||||
require.Nil(t, err)
|
||||
|
||||
err = th.App.Srv.Store.Preference().Save(&model.Preferences{{
|
||||
err = th.App.Srv().Store.Preference().Save(&model.Preferences{{
|
||||
UserId: th.BasicUser.Id,
|
||||
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
|
||||
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
|
||||
@@ -109,10 +109,10 @@ func TestCheckPendingNotifications(t *testing.T) {
|
||||
require.Len(t, job.pendingNotifications[th.BasicUser.Id], 1, "shouldn't have sent queued post")
|
||||
|
||||
// test that notifications are cleared if the user has acted
|
||||
channelMember, err = th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
channelMember, err = th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
channelMember.LastViewedAt = 10001000
|
||||
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
|
||||
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
|
||||
require.Nil(t, err)
|
||||
|
||||
job.checkPendingNotifications(time.Unix(10002, 0), func(string, []*batchedNotification) {})
|
||||
@@ -186,10 +186,10 @@ func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
|
||||
job := NewEmailBatchingJob(th.Server, 128)
|
||||
|
||||
// bypasses recent user activity check
|
||||
channelMember, err := th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
channelMember, err := th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
channelMember.LastViewedAt = 9999000
|
||||
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
|
||||
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
|
||||
require.Nil(t, err)
|
||||
|
||||
job.pendingNotifications[th.BasicUser.Id] = []*batchedNotification{
|
||||
@@ -224,14 +224,14 @@ func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
|
||||
job := NewEmailBatchingJob(th.Server, 128)
|
||||
|
||||
// bypasses recent user activity check
|
||||
channelMember, err := th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
channelMember, err := th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
|
||||
require.Nil(t, err)
|
||||
channelMember.LastViewedAt = 9999000
|
||||
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
|
||||
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
|
||||
require.Nil(t, err)
|
||||
|
||||
// preference value is not an integer, so we'll fall back to the default 15min value
|
||||
err = th.App.Srv.Store.Preference().Save(&model.Preferences{{
|
||||
err = th.App.Srv().Store.Preference().Save(&model.Preferences{{
|
||||
UserId: th.BasicUser.Id,
|
||||
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
|
||||
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
|
||||
|
||||
Ссылка в новой задаче
Block a user