Add caching for file infos (#5330)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
eb767d2c1c
Коммит
487bb56a9b
@@ -136,7 +136,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)).([]*model.FileInfo)
|
||||
infos := store.Must(app.Srv.Store.FileInfo().GetForPost(rpost9.Id, true)).([]*model.FileInfo)
|
||||
|
||||
if len(infos) != 3 {
|
||||
t.Fatal("should've attached all 3 files to post")
|
||||
@@ -1184,6 +1184,7 @@ func TestGetMessageForNotification(t *testing.T) {
|
||||
|
||||
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" {
|
||||
t.Fatal("should've returned number of images:", message)
|
||||
}
|
||||
@@ -1196,6 +1197,7 @@ func TestGetMessageForNotification(t *testing.T) {
|
||||
}
|
||||
|
||||
store.Must(app.Srv.Store.FileInfo().AttachToPost(testJpg2.Id, post.Id))
|
||||
app.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" {
|
||||
t.Fatal("should've returned number of mixed files:", message)
|
||||
|
||||
Ссылка в новой задаче
Block a user