[MM-15858] Migrate "Post.GetPostsCreatedAt" to Sync by default (#11021)
* Migrate "Post.GetPostsCreatedAt" to Sync by default * Fix variable misuse
Этот коммит содержится в:
коммит произвёл
Jesse Hallam
родитель
cc6c385d3e
Коммит
a57e042dab
@@ -1891,10 +1891,10 @@ func TestImportImportPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 1, team.Id)
|
||||
|
||||
// Check the post values.
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, time); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
posts, err := th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, time)
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
posts := result.Data.([]*model.Post)
|
||||
if len(posts) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -1917,10 +1917,10 @@ func TestImportImportPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 1, team.Id)
|
||||
|
||||
// Check the post values.
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, time); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, time)
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
posts := result.Data.([]*model.Post)
|
||||
if len(posts) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -1968,10 +1968,10 @@ func TestImportImportPost(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 4, team.Id)
|
||||
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, hashtagTime); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, hashtagTime)
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
posts := result.Data.([]*model.Post)
|
||||
if len(posts) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -2013,10 +2013,9 @@ func TestImportImportPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 5, team.Id)
|
||||
|
||||
// Check the post values.
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, flagsTime); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
if posts, err := th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, flagsTime); err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
posts := result.Data.([]*model.Post)
|
||||
if len(posts) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -2050,10 +2049,9 @@ func TestImportImportPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 6, team.Id)
|
||||
|
||||
// Check the post values.
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, reactionPostTime); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
if posts, err := th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, reactionPostTime); err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
posts := result.Data.([]*model.Post)
|
||||
if len(posts) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -2090,10 +2088,9 @@ func TestImportImportPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 8, team.Id)
|
||||
|
||||
// Check the post values.
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, replyPostTime); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
if posts, err := th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, replyPostTime); err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
posts := result.Data.([]*model.Post)
|
||||
if len(posts) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -2103,10 +2100,9 @@ func TestImportImportPost(t *testing.T) {
|
||||
}
|
||||
|
||||
// Check the reply values.
|
||||
if result := <-th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, replyTime); result.Err != nil {
|
||||
t.Fatal(result.Err.Error())
|
||||
if replies, err := th.App.Srv.Store.Post().GetPostsCreatedAt(channel.Id, replyTime); err != nil {
|
||||
t.Fatal(err.Error())
|
||||
} else {
|
||||
replies := result.Data.([]*model.Post)
|
||||
if len(replies) != 1 {
|
||||
t.Fatal("Unexpected number of posts found.")
|
||||
}
|
||||
@@ -2434,10 +2430,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 1, "")
|
||||
|
||||
// Check the post values.
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts := result.Data.([]*model.Post)
|
||||
posts, err := th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post := posts[0]
|
||||
@@ -2451,10 +2445,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 1, "")
|
||||
|
||||
// Check the post values.
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
@@ -2481,10 +2473,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 4, "")
|
||||
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
@@ -2512,10 +2502,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
|
||||
// Check the post values.
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(directChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
@@ -2613,10 +2601,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 1, "")
|
||||
|
||||
// Check the post values.
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
@@ -2630,10 +2616,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 1, "")
|
||||
|
||||
// Check the post values.
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
@@ -2660,10 +2644,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
AssertAllPostsCount(t, th.App, initialPostCount, 4, "")
|
||||
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
@@ -2692,10 +2674,8 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
|
||||
// Check the post values.
|
||||
result = <-th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, result.Err)
|
||||
|
||||
posts = result.Data.([]*model.Post)
|
||||
posts, err = th.App.Srv.Store.Post().GetPostsCreatedAt(groupChannel.Id, *data.CreateAt)
|
||||
require.Nil(t, err)
|
||||
require.Equal(t, len(posts), 1)
|
||||
|
||||
post = posts[0]
|
||||
|
||||
Ссылка в новой задаче
Block a user