mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 12:53:46 +08:00
FIX: Don't show the "Flag to delete" message to staff
If they can't delete, flagging should not either.
This commit is contained in:
parent
7a21f78f8c
commit
7a9e85b1d7
|
@ -45,6 +45,7 @@ export function transformBasicPost(post) {
|
||||||
created_at: post.created_at,
|
created_at: post.created_at,
|
||||||
updated_at: post.updated_at,
|
updated_at: post.updated_at,
|
||||||
canDelete: post.can_delete,
|
canDelete: post.can_delete,
|
||||||
|
showFlagDelete: false,
|
||||||
canRecover: post.can_recover,
|
canRecover: post.can_recover,
|
||||||
canEdit: post.can_edit,
|
canEdit: post.can_edit,
|
||||||
canFlag: !Ember.isEmpty(post.get("flagsAvailable")),
|
canFlag: !Ember.isEmpty(post.get("flagsAvailable")),
|
||||||
|
@ -230,6 +231,15 @@ export default function transformPost(
|
||||||
postAtts.canRecoverTopic = postAtts.isDeleted && details.can_recover;
|
postAtts.canRecoverTopic = postAtts.isDeleted && details.can_recover;
|
||||||
postAtts.canDeleteTopic = !postAtts.isDeleted && details.can_delete;
|
postAtts.canDeleteTopic = !postAtts.isDeleted && details.can_delete;
|
||||||
postAtts.expandablePost = topic.expandable_first_post;
|
postAtts.expandablePost = topic.expandable_first_post;
|
||||||
|
|
||||||
|
// Show a "Flag to delete" message if not staff and you can't
|
||||||
|
// otherwise delete it.
|
||||||
|
postAtts.showFlagDelete = (
|
||||||
|
!postAtts.canDelete &&
|
||||||
|
postAtts.yours &&
|
||||||
|
(currentUser && !currentUser.staff)
|
||||||
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
postAtts.canRecover = postAtts.isDeleted && postAtts.canRecover;
|
postAtts.canRecover = postAtts.isDeleted && postAtts.canRecover;
|
||||||
postAtts.canDelete =
|
postAtts.canDelete =
|
||||||
|
|
|
@ -307,7 +307,7 @@ registerButton("delete", attrs => {
|
||||||
icon: "far-trash-alt",
|
icon: "far-trash-alt",
|
||||||
className: "delete"
|
className: "delete"
|
||||||
};
|
};
|
||||||
} else if (!attrs.canDelete && attrs.firstPost && attrs.yours) {
|
} else if (attrs.showFlagDelete) {
|
||||||
return {
|
return {
|
||||||
id: "delete_topic",
|
id: "delete_topic",
|
||||||
action: "showDeleteTopicModal",
|
action: "showDeleteTopicModal",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user