diff options
-rw-r--r-- | askbot/skins/common/media/js/user.js | 12 | ||||
-rw-r--r-- | askbot/skins/default/templates/user_profile/user_inbox.html | 1 | ||||
-rw-r--r-- | askbot/views/commands.py | 7 |
3 files changed, 15 insertions, 5 deletions
diff --git a/askbot/skins/common/media/js/user.js b/askbot/skins/common/media/js/user.js index f3b4ed8e..5d205560 100644 --- a/askbot/skins/common/media/js/user.js +++ b/askbot/skins/common/media/js/user.js @@ -18,7 +18,7 @@ $(document).ready(function(){ }; var submit = function(id_list, elements, action_type){ - if (action_type == 'delete' || action_type == 'mark_new' || action_type == 'mark_seen' || action_type == 'remove_flag' || action_type == 'close'){ + if (action_type == 'delete' || action_type == 'mark_new' || action_type == 'mark_seen' || action_type == 'remove_flag' || action_type == 'close' || action_type == 'delete_post'){ $.ajax({ type: 'POST', cache: false, @@ -27,7 +27,7 @@ $(document).ready(function(){ url: askbot['urls']['manageInbox'], success: function(response_data){ if (response_data['success'] === true){ - if (action_type == 'delete' || action_type == 'remove_flag' || action_type == 'close'){ + if (action_type == 'delete' || action_type == 'remove_flag' || action_type == 'close' || action_type == 'delete_post'){ elements.remove(); } else if (action_type == 'mark_new'){ @@ -75,6 +75,13 @@ $(document).ready(function(){ return; } } + if (action_type == 'delete_post'){ + msg = ngettext('Delete this entry?', + 'Delete these entries?', data['id_list'].length); + if (confirm(msg) === false){ + return; + } + } submit(data['id_list'], data['elements'], action_type); }; setupButtonEventHandlers($('#re_mark_seen'), function(){startAction('mark_seen')}); @@ -82,6 +89,7 @@ $(document).ready(function(){ setupButtonEventHandlers($('#re_dismiss'), function(){startAction('delete')}); setupButtonEventHandlers($('#re_remove_flag'), function(){startAction('remove_flag')}); setupButtonEventHandlers($('#re_close'), function(){startAction('close')}); + setupButtonEventHandlers($('#re_delete_post'), function(){startAction('delete_post')}); setupButtonEventHandlers( $('#sel_all'), function(){ diff --git a/askbot/skins/default/templates/user_profile/user_inbox.html b/askbot/skins/default/templates/user_profile/user_inbox.html index 9d5d3db6..f70f1884 100644 --- a/askbot/skins/default/templates/user_profile/user_inbox.html +++ b/askbot/skins/default/templates/user_profile/user_inbox.html @@ -65,6 +65,7 @@ inbox_section - forum|flags <a id="sel_none">{% trans %}none{% endtrans %}</a><br /> <button id="re_remove_flag">{% trans %}remove flags{% endtrans %}</button> <button id="re_close">{% trans %}close{% endtrans %}</button> + <button id="re_delete_post">{% trans %}delete post{% endtrans %}</button> </div> {% endif %} <div id="responses"> diff --git a/askbot/views/commands.py b/askbot/views/commands.py index 2e289d2e..577946cc 100644 --- a/askbot/views/commands.py +++ b/askbot/views/commands.py @@ -63,9 +63,10 @@ def manage_inbox(request): for memo in memo_set: if memo.activity.content_object.post_type == "question": request.user.close_question(question = memo.activity.content_object, reason = 7) - else: - memo.activity.content_object.deleted = True - memo.activity.content_object.save() + memo.delete() + elif action_type == 'delete_post': + for memo in memo_set: + request.user.delete_post(post = memo.activity.content_object) memo.delete() else: raise exceptions.PermissionDenied( |