Update /t/1000 Delete Post Protection

  • Continuing the discussion from Updating the editor buttons:

    @boomzilla said:

    Below is the current (Discourse v1.4 Beta 😎 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 );
    	var a=function(a){
    				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"),
    			b.apply( this, arguments );
    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.

Log in to reply

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.