forked from Ivasoft/mattermost-mobile
[Gekidou] post list (#5893)
This commit is contained in:
@@ -19,12 +19,12 @@ export function areConsecutivePosts(post: PostModel, previousPost: PostModel) {
|
||||
const isFromSameUser = previousPost.userId === post.userId;
|
||||
const isNotSystemMessage = !isSystemMessage(post) && !isSystemMessage(previousPost);
|
||||
const isInTimeframe = (post.createAt - previousPost.createAt) <= Post.POST_COLLAPSE_TIMEOUT;
|
||||
const isSameThread = (previousPost.rootId === post.rootId || previousPost.id === post.rootId);
|
||||
|
||||
// Were the last post and this post made by the same user within some time?
|
||||
consecutive = previousPost && (isFromSameUser || isInTimeframe) && !postFromWebhook &&
|
||||
!prevPostFromWebhook && isNotSystemMessage && isSameThread;
|
||||
consecutive = previousPost && isFromSameUser && isInTimeframe && !postFromWebhook &&
|
||||
!prevPostFromWebhook && isNotSystemMessage;
|
||||
}
|
||||
|
||||
return consecutive;
|
||||
}
|
||||
|
||||
@@ -73,3 +73,13 @@ export const getMentionKeysForPost = (user: UserModel, post: PostModel, groups:
|
||||
|
||||
return keys;
|
||||
};
|
||||
|
||||
export const sortPostsByNewest = (posts: PostModel[]) => {
|
||||
return posts.sort((a, b) => {
|
||||
if (a.createAt > b.createAt) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user