Fix webhook post aggregation and pending/failed post aggregation
Этот коммит содержится в:
@@ -94,22 +94,53 @@ export default class PostsView extends React.Component {
|
|||||||
const prevPostIsComment = Utils.isComment(prevPost);
|
const prevPostIsComment = Utils.isComment(prevPost);
|
||||||
const postFromWebhook = Boolean(post.props && post.props.from_webhook);
|
const postFromWebhook = Boolean(post.props && post.props.from_webhook);
|
||||||
const prevPostFromWebhook = Boolean(prevPost.props && prevPost.props.from_webhook);
|
const prevPostFromWebhook = Boolean(prevPost.props && prevPost.props.from_webhook);
|
||||||
|
let prevWebhookName = '';
|
||||||
|
if (prevPost.props && prevPost.props.override_username) {
|
||||||
|
prevWebhookName = prevPost.props.override_username;
|
||||||
|
}
|
||||||
|
let curWebhookName = '';
|
||||||
|
if (post.props && post.props.override_username) {
|
||||||
|
curWebhookName = post.props.override_username;
|
||||||
|
}
|
||||||
|
|
||||||
sameUser = prevPost.user_id === post.user_id && postFromWebhook === prevPostFromWebhook &&
|
// consider posts from the same user if:
|
||||||
post.create_at - prevPost.create_at <= 1000 * 60 * 5;
|
// the previous post was made by the same user as the current post,
|
||||||
sameRoot = (postIsComment && (prevPost.id === post.root_id || prevPost.root_id === post.root_id)) || (!postIsComment && !prevPostIsComment && sameUser);
|
// the previous post was made within 5 minutes of the current post,
|
||||||
|
// the previous post and current post are both from webhooks or both not,
|
||||||
|
// the previous post and current post have the same webhook usernames
|
||||||
|
if (prevPost.user_id === post.user_id &&
|
||||||
|
post.create_at - prevPost.create_at <= 1000 * 60 * 5 &&
|
||||||
|
postFromWebhook === prevPostFromWebhook &&
|
||||||
|
prevWebhookName === curWebhookName) {
|
||||||
|
sameUser = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// consider posts from the same root if:
|
||||||
|
// the current post is a comment,
|
||||||
|
// the current post has the same root as the previous post
|
||||||
|
if (postIsComment && (prevPost.id === post.root_id || prevPost.root_id === post.root_id)) {
|
||||||
|
sameRoot = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// consider posts from the same root if:
|
||||||
|
// the current post is not a comment,
|
||||||
|
// the previous post is not a comment,
|
||||||
|
// the previous post is from the same user
|
||||||
|
if (!postIsComment && !prevPostIsComment && sameUser) {
|
||||||
|
sameRoot = true;
|
||||||
|
}
|
||||||
|
|
||||||
// hide the profile pic if:
|
// hide the profile pic if:
|
||||||
// the previous post was made by the same user as the current post,
|
// the previous post was made by the same user as the current post,
|
||||||
// the previous post is not a comment,
|
// the previous post is not a comment,
|
||||||
// the current post is not a comment,
|
// the current post is not a comment,
|
||||||
// the current post is not from a webhook
|
// the previous post and current post are both from webhooks or both not,
|
||||||
// and the previous post is not from a webhook
|
// the previous post and current post have the same webhook usernames
|
||||||
if ((prevPost.user_id === post.user_id) &&
|
if (prevPost.user_id === post.user_id &&
|
||||||
!prevPostIsComment &&
|
!prevPostIsComment &&
|
||||||
!postIsComment &&
|
!postIsComment &&
|
||||||
!postFromWebhook &&
|
postFromWebhook === prevPostFromWebhook &&
|
||||||
!prevPostFromWebhook) {
|
prevWebhookName === curWebhookName) {
|
||||||
hideProfilePic = true;
|
hideProfilePic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -854,7 +854,7 @@ export function isMobile() {
|
|||||||
|
|
||||||
export function isComment(post) {
|
export function isComment(post) {
|
||||||
if ('root_id' in post) {
|
if ('root_id' in post) {
|
||||||
return post.root_id !== '';
|
return post.root_id !== '' && post.root_id != null;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user