feat: add topicOwnerPost #8778

This commit is contained in:
Barış Soner Uşaklı
2020-11-25 17:58:44 -05:00
parent 6a819944d5
commit c037779fa1
3 changed files with 11 additions and 3 deletions

View File

@@ -47,11 +47,16 @@ define('forum/topic/posts', [
Posts.modifyPostsByPrivileges = function (posts) {
posts.forEach(function (post) {
post.selfPost = !!app.user.uid && parseInt(post.uid, 10) === parseInt(app.user.uid, 10);
post.topicOwnerPost = parseInt(post.uid, 10) === parseInt(ajaxify.data.uid, 10);
post.display_edit_tools = (ajaxify.data.privileges['posts:edit'] && post.selfPost) || ajaxify.data.privileges.isAdminOrMod;
post.display_delete_tools = (ajaxify.data.privileges['posts:delete'] && post.selfPost) || ajaxify.data.privileges.isAdminOrMod;
post.display_moderator_tools = post.display_edit_tools || post.display_delete_tools;
post.display_move_tools = ajaxify.data.privileges.isAdminOrMod;
post.display_post_menu = ajaxify.data.privileges.isAdminOrMod || (post.selfPost && !ajaxify.data.locked) || ((app.user.uid || ajaxify.data.postSharing.length) && !post.deleted);
post.display_post_menu = ajaxify.data.privileges.isAdminOrMod ||
(post.selfPost && !ajaxify.data.locked && !post.deleted) ||
(post.selfPost && post.deleted && parseInt(post.deleterUid, 10) === parseInt(app.user.uid, 10)) ||
((app.user.uid || ajaxify.data.postSharing.length) && !post.deleted);
});
};