MM-38164: Paginate the GetPostThread API (#19485)
We implement a cursor based pagination model to page through the posts in a given thread. The cursor is a combination of the post.CreateAt+ post.Id to differentiate multiple posts in a given timestamp. Some additional parameters like direction, fromPost, fromCreateAt and perPage were introduced to implement this. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ad5f57b161
Коммит
c1f3827801
@@ -31,7 +31,10 @@ func (scs *Service) processPermalinkToRemote(p *model.Post) string {
|
||||
// Extract the postID (This is simple enough not to warrant full-blown URL parsing.)
|
||||
lastSlash := strings.LastIndexByte(msg, '/')
|
||||
postID := msg[lastSlash+1:]
|
||||
postList, err := scs.server.GetStore().Post().Get(context.Background(), postID, true, false, false, "")
|
||||
opts := model.GetPostsOptions{
|
||||
SkipFetchThreads: true,
|
||||
}
|
||||
postList, err := scs.server.GetStore().Post().Get(context.Background(), postID, opts, "")
|
||||
if err != nil {
|
||||
scs.server.GetLogger().Log(mlog.LvlSharedChannelServiceWarn, "Unable to get post during replacing permalinks", mlog.Err(err))
|
||||
return msg
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestProcessPermalinkToRemote(t *testing.T) {
|
||||
utils.TranslationsPreInit()
|
||||
|
||||
pl := &model.PostList{}
|
||||
mockPostStore.On("Get", context.Background(), "postID", true, false, false, "").Return(pl, nil)
|
||||
mockPostStore.On("Get", context.Background(), "postID", model.GetPostsOptions{SkipFetchThreads: true}, "").Return(pl, nil)
|
||||
|
||||
mockStore.On("Post").Return(&mockPostStore)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user