diff --git a/app/assets/javascripts/admin/controllers/admin_flags_controller.js.coffee b/app/assets/javascripts/admin/controllers/admin_flags_controller.js.coffee index c1f0e781b8f..99f8e3439f1 100644 --- a/app/assets/javascripts/admin/controllers/admin_flags_controller.js.coffee +++ b/app/assets/javascripts/admin/controllers/admin_flags_controller.js.coffee @@ -7,6 +7,13 @@ window.Discourse.AdminFlagsController = Ember.Controller.extend bootbox.alert("something went wrong") ) + deletePost: (item) -> + item.deletePost().then (=> + @content.removeObject(item) + ), (-> + bootbox.alert("something went wrong") + ) + adminOldFlagsView: (-> @query == 'old' ).property('query') diff --git a/app/assets/javascripts/admin/models/flagged_post.js.coffee b/app/assets/javascripts/admin/models/flagged_post.js.coffee index 6d3f0fa0bc3..cc35232c7bd 100644 --- a/app/assets/javascripts/admin/models/flagged_post.js.coffee +++ b/app/assets/javascripts/admin/models/flagged_post.js.coffee @@ -28,6 +28,25 @@ window.Discourse.FlaggedPost = Discourse.Post.extend @get('topic_visible') == 'f' ).property('topic_hidden') + deletePost: -> + promise = new RSVP.Promise() + if @get('post_number') == "1" + $.ajax "/t/#{@topic_id}", + type: 'DELETE' + cache: false + success: -> + promise.resolve() + error: (e)-> + promise.reject() + else + $.ajax "/posts/#{@id}", + type: 'DELETE' + cache: false + success: -> + promise.resolve() + error: (e)-> + promise.reject() + clearFlags: -> promise = new RSVP.Promise() $.ajax "/admin/flags/clear/#{@id}", diff --git a/app/assets/javascripts/admin/templates/flags.js.handlebars b/app/assets/javascripts/admin/templates/flags.js.handlebars index cf567f32310..929076b5cec 100644 --- a/app/assets/javascripts/admin/templates/flags.js.handlebars +++ b/app/assets/javascripts/admin/templates/flags.js.handlebars @@ -21,14 +21,15 @@
{{#each content}}