Moving app from singular to being created for every request (#9889)

* Moving app from singular to being created for every request.

* Automatic refactor

* Adding license header

* Feedback fixes
Этот коммит содержится в:
Christopher Speller
2018-11-28 10:56:21 -08:00
коммит произвёл GitHub
родитель 1bcf08aa4b
Коммит da265fbaf7
68 изменённых файлов: 1272 добавлений и 1096 удалений

Просмотреть файл

@@ -21,7 +21,7 @@ func TestHandleNewNotifications(t *testing.T) {
id3 := model.NewId()
// test queueing of received posts by user
job := NewEmailBatchingJob(th.App, 128)
job := NewEmailBatchingJob(th.Server, 128)
job.handleNewNotifications()
@@ -75,7 +75,7 @@ func TestHandleNewNotifications(t *testing.T) {
}
// test ordering of received posts
job = NewEmailBatchingJob(th.App, 128)
job = NewEmailBatchingJob(th.Server, 128)
job.Add(&model.User{Id: id1}, &model.Post{UserId: id1, Message: "test1"}, &model.Team{Name: "team"})
job.Add(&model.User{Id: id1}, &model.Post{UserId: id1, Message: "test2"}, &model.Team{Name: "team"})
@@ -97,7 +97,7 @@ func TestCheckPendingNotifications(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
job := NewEmailBatchingJob(th.App, 128)
job := NewEmailBatchingJob(th.Server, 128)
job.pendingNotifications[th.BasicUser.Id] = []*batchedNotification{
{
post: &model.Post{
@@ -205,7 +205,7 @@ func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
job := NewEmailBatchingJob(th.App, 128)
job := NewEmailBatchingJob(th.Server, 128)
// bypasses recent user activity check
channelMember := store.Must(th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)).(*model.ChannelMember)
@@ -243,7 +243,7 @@ func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
job := NewEmailBatchingJob(th.App, 128)
job := NewEmailBatchingJob(th.Server, 128)
// bypasses recent user activity check
channelMember := store.Must(th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)).(*model.ChannelMember)
@@ -303,7 +303,7 @@ func TestRenderBatchedPostGeneric(t *testing.T) {
return translationID
}
var rendered = th.App.renderBatchedPost(notification, channel, sender, "http://localhost:8065", "", translateFunc, "en", model.EMAIL_NOTIFICATION_CONTENTS_GENERIC)
var rendered = th.Server.renderBatchedPost(notification, channel, sender, "http://localhost:8065", "", translateFunc, "en", model.EMAIL_NOTIFICATION_CONTENTS_GENERIC)
if strings.Contains(rendered, post.Message) {
t.Fatal("Rendered email should not contain post contents when email notification contents type is set to Generic.")
}
@@ -330,7 +330,7 @@ func TestRenderBatchedPostFull(t *testing.T) {
return translationID
}
var rendered = th.App.renderBatchedPost(notification, channel, sender, "http://localhost:8065", "", translateFunc, "en", model.EMAIL_NOTIFICATION_CONTENTS_FULL)
var rendered = th.Server.renderBatchedPost(notification, channel, sender, "http://localhost:8065", "", translateFunc, "en", model.EMAIL_NOTIFICATION_CONTENTS_FULL)
if !strings.Contains(rendered, post.Message) {
t.Fatal("Rendered email should contain post contents when email notification contents type is set to Full.")
}