mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: show modal when user without permissions tries to delete their own topic (#6086)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
{{#d-modal-body}}
|
||||
<p>{{{i18n "post.controls.delete_topic_disallowed_modal"}}}</p>
|
||||
{{/d-modal-body}}
|
||||
<div class="modal-footer">
|
||||
{{d-button action="closeModal" class="btn-primary" label="close"}}
|
||||
</div>
|
||||
@@ -1,6 +1,7 @@
|
||||
import { applyDecorators, createWidget } from "discourse/widgets/widget";
|
||||
import { avatarAtts } from "discourse/widgets/actions-summary";
|
||||
import { h } from "virtual-dom";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
|
||||
const LIKE_ACTION = 2;
|
||||
|
||||
@@ -281,6 +282,14 @@ registerButton("delete", attrs => {
|
||||
icon: "trash-o",
|
||||
className: "delete"
|
||||
};
|
||||
} else if (!attrs.canDelete && attrs.firstPost && attrs.yours) {
|
||||
return {
|
||||
id: "delete_topic",
|
||||
action: "showDeleteTopicModal",
|
||||
title: "post.controls.delete_topic_disallowed",
|
||||
icon: "trash-o",
|
||||
className: "delete"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -467,6 +476,10 @@ export default createWidget("post-menu", {
|
||||
this.state.adminVisible = false;
|
||||
},
|
||||
|
||||
showDeleteTopicModal() {
|
||||
showModal("delete-topic-disallowed");
|
||||
},
|
||||
|
||||
showMoreActions() {
|
||||
this.state.collapsed = false;
|
||||
if (!this.state.likedUsers.length) {
|
||||
|
||||
Reference in New Issue
Block a user