Update /t/1000 Delete Post Protection
-
Continuing the discussion from Updating the editor buttons:
Below is the current (Discourse v1.4 Beta 8) code for the custom editor buttons.
...and the code preventing users from deleting in /t/1000:
// prevent deletes in /t/1000 function preventT1000Deletes(){ var b=Discourse.PostMenuComponent.prototype.clickDelete; if( !b ){ var id = setTimeout( preventT1000Deletes, 1000 ); return; } var a=function(a){ if(1E3==a.topic_id){ return $("#discourse-modal #modal-alert").html("<img style='padding:10px;' src='/uploads/default/8214/16c00f5bd6b57125.png'/>Press <kbd>ctrl + w</kbd> to delete anyway?"), $("#discourse-modal h3").html("Please do not delete posts from the 1000 thread. Edit your post, or flag it for moderator attention to hide content. Thanks"), $("#discourse-modal").modal("show"),!1; } b.apply( this, arguments ); }; Discourse.PostMenuComponent.reopen({clickDelete:a}); Discourse.PostMenuComponent.prototype.clickDelete=a; } setTimeout( preventT1000Deletes, 200 );
-
So...I'm thinking for this, we just want:
var b = require('discourse/components/post-menu').default.prototype.clickDelete;
EDIT: Eh...actually, we use PMV later, so same deal as before.