app type transition (#7167)
Этот коммит содержится в:
@@ -142,7 +142,7 @@ func TestCreatePost(t *testing.T) {
|
||||
} else if rpost9 := resp.Data.(*model.Post); len(rpost9.FileIds) != 3 {
|
||||
t.Fatal("post should have 3 files")
|
||||
} else {
|
||||
infos := store.Must(app.Srv.Store.FileInfo().GetForPost(rpost9.Id, true, true)).([]*model.FileInfo)
|
||||
infos := store.Must(adm.App.Srv.Store.FileInfo().GetForPost(rpost9.Id, true, true)).([]*model.FileInfo)
|
||||
|
||||
if len(infos) != 3 {
|
||||
t.Fatal("should've attached all 3 files to post")
|
||||
@@ -164,7 +164,7 @@ func TestCreatePost(t *testing.T) {
|
||||
utils.SetLicense(&model.License{Features: &model.Features{}})
|
||||
utils.License().Features.SetDefaults()
|
||||
|
||||
defaultChannel := store.Must(app.Srv.Store.Channel().GetByName(team.Id, model.DEFAULT_CHANNEL, true)).(*model.Channel)
|
||||
defaultChannel := store.Must(adm.App.Srv.Store.Channel().GetByName(team.Id, model.DEFAULT_CHANNEL, true)).(*model.Channel)
|
||||
defaultPost := &model.Post{
|
||||
ChannelId: defaultChannel.Id,
|
||||
Message: "Default Channel Post",
|
||||
@@ -173,7 +173,7 @@ func TestCreatePost(t *testing.T) {
|
||||
t.Fatal("should have failed -- ExperimentalTownSquareIsReadOnly is true and it's a read only channel")
|
||||
}
|
||||
|
||||
adminDefaultChannel := store.Must(app.Srv.Store.Channel().GetByName(adminTeam.Id, model.DEFAULT_CHANNEL, true)).(*model.Channel)
|
||||
adminDefaultChannel := store.Must(adm.App.Srv.Store.Channel().GetByName(adminTeam.Id, model.DEFAULT_CHANNEL, true)).(*model.Channel)
|
||||
adminDefaultPost := &model.Post{
|
||||
ChannelId: adminDefaultChannel.Id,
|
||||
Message: "Admin Default Channel Post",
|
||||
@@ -1085,7 +1085,7 @@ func TestEmailMention(t *testing.T) {
|
||||
data["comments"] = "any"
|
||||
Client.Must(Client.UpdateUserNotify(data))
|
||||
|
||||
store.Must(app.Srv.Store.Preference().Save(&model.Preferences{{
|
||||
store.Must(th.App.Srv.Store.Preference().Save(&model.Preferences{{
|
||||
UserId: th.BasicUser2.Id,
|
||||
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
|
||||
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
|
||||
@@ -1189,28 +1189,28 @@ func TestGetFlaggedPosts(t *testing.T) {
|
||||
func TestGetMessageForNotification(t *testing.T) {
|
||||
Setup().InitBasic()
|
||||
|
||||
testPng := store.Must(app.Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
testPng := store.Must(app.Global().Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
CreatorId: model.NewId(),
|
||||
Path: "test1.png",
|
||||
Name: "test1.png",
|
||||
MimeType: "image/png",
|
||||
})).(*model.FileInfo)
|
||||
|
||||
testJpg1 := store.Must(app.Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
testJpg1 := store.Must(app.Global().Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
CreatorId: model.NewId(),
|
||||
Path: "test2.jpg",
|
||||
Name: "test2.jpg",
|
||||
MimeType: "image/jpeg",
|
||||
})).(*model.FileInfo)
|
||||
|
||||
testFile := store.Must(app.Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
testFile := store.Must(app.Global().Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
CreatorId: model.NewId(),
|
||||
Path: "test1.go",
|
||||
Name: "test1.go",
|
||||
MimeType: "text/plain",
|
||||
})).(*model.FileInfo)
|
||||
|
||||
testJpg2 := store.Must(app.Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
testJpg2 := store.Must(app.Global().Srv.Store.FileInfo().Save(&model.FileInfo{
|
||||
CreatorId: model.NewId(),
|
||||
Path: "test3.jpg",
|
||||
Name: "test3.jpg",
|
||||
@@ -1224,39 +1224,39 @@ func TestGetMessageForNotification(t *testing.T) {
|
||||
Message: "test",
|
||||
}
|
||||
|
||||
if app.GetMessageForNotification(post, translateFunc) != "test" {
|
||||
if app.Global().GetMessageForNotification(post, translateFunc) != "test" {
|
||||
t.Fatal("should've returned message text")
|
||||
}
|
||||
|
||||
post.FileIds = model.StringArray{testPng.Id}
|
||||
store.Must(app.Srv.Store.FileInfo().AttachToPost(testPng.Id, post.Id))
|
||||
if app.GetMessageForNotification(post, translateFunc) != "test" {
|
||||
store.Must(app.Global().Srv.Store.FileInfo().AttachToPost(testPng.Id, post.Id))
|
||||
if app.Global().GetMessageForNotification(post, translateFunc) != "test" {
|
||||
t.Fatal("should've returned message text, even with attachments")
|
||||
}
|
||||
|
||||
post.Message = ""
|
||||
if message := app.GetMessageForNotification(post, translateFunc); message != "1 image sent: test1.png" {
|
||||
if message := app.Global().GetMessageForNotification(post, translateFunc); message != "1 image sent: test1.png" {
|
||||
t.Fatal("should've returned number of images:", message)
|
||||
}
|
||||
|
||||
post.FileIds = model.StringArray{testPng.Id, testJpg1.Id}
|
||||
store.Must(app.Srv.Store.FileInfo().AttachToPost(testJpg1.Id, post.Id))
|
||||
app.Srv.Store.FileInfo().InvalidateFileInfosForPostCache(post.Id)
|
||||
if message := app.GetMessageForNotification(post, translateFunc); message != "2 images sent: test1.png, test2.jpg" && message != "2 images sent: test2.jpg, test1.png" {
|
||||
store.Must(app.Global().Srv.Store.FileInfo().AttachToPost(testJpg1.Id, post.Id))
|
||||
app.Global().Srv.Store.FileInfo().InvalidateFileInfosForPostCache(post.Id)
|
||||
if message := app.Global().GetMessageForNotification(post, translateFunc); message != "2 images sent: test1.png, test2.jpg" && message != "2 images sent: test2.jpg, test1.png" {
|
||||
t.Fatal("should've returned number of images:", message)
|
||||
}
|
||||
|
||||
post.Id = model.NewId()
|
||||
post.FileIds = model.StringArray{testFile.Id}
|
||||
store.Must(app.Srv.Store.FileInfo().AttachToPost(testFile.Id, post.Id))
|
||||
if message := app.GetMessageForNotification(post, translateFunc); message != "1 file sent: test1.go" {
|
||||
store.Must(app.Global().Srv.Store.FileInfo().AttachToPost(testFile.Id, post.Id))
|
||||
if message := app.Global().GetMessageForNotification(post, translateFunc); message != "1 file sent: test1.go" {
|
||||
t.Fatal("should've returned number of files:", message)
|
||||
}
|
||||
|
||||
store.Must(app.Srv.Store.FileInfo().AttachToPost(testJpg2.Id, post.Id))
|
||||
app.Srv.Store.FileInfo().InvalidateFileInfosForPostCache(post.Id)
|
||||
store.Must(app.Global().Srv.Store.FileInfo().AttachToPost(testJpg2.Id, post.Id))
|
||||
app.Global().Srv.Store.FileInfo().InvalidateFileInfosForPostCache(post.Id)
|
||||
post.FileIds = model.StringArray{testFile.Id, testJpg2.Id}
|
||||
if message := app.GetMessageForNotification(post, translateFunc); message != "2 files sent: test1.go, test3.jpg" && message != "2 files sent: test3.jpg, test1.go" {
|
||||
if message := app.Global().GetMessageForNotification(post, translateFunc); message != "2 files sent: test1.go, test3.jpg" && message != "2 files sent: test3.jpg, test1.go" {
|
||||
t.Fatal("should've returned number of mixed files:", message)
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user