diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 36a3fa92c2e..ab8a99bbc6c 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -575,7 +575,7 @@ class WebsiteForum(http.Controller): request.registry['forum.post'].unlink(request.cr, SUPERUSER_ID, [post.id], context=request.context) return self.post_comment(forum, question, **values) - @http.route('/forum/message_delete', type='json', auth="user", multilang=True, methods=['POST'], website=True) - def delete_comment(self, **kwarg): - request.registry['mail.message'].unlink(request.cr, SUPERUSER_ID, [int(kwarg.get('message_id'))], context=request.context) + @http.route('/forum//post//comment//delete', type='json', auth="user", multilang=True, website=True) + def delete_comment(self, forum, post, comment, **kwarg): + request.registry['mail.message'].unlink(request.cr, SUPERUSER_ID, [comment.id], context=request.context) return True diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js index 715b9d19e0f..56de026728c 100644 --- a/addons/website_forum/static/src/js/website_forum.js +++ b/addons/website_forum/static/src/js/website_forum.js @@ -99,11 +99,8 @@ $(document).ready(function () { $('.comment_delete').on('click', function (ev) { ev.preventDefault(); var $link = $(ev.currentTarget); - var forum_id = $link.data('forum-id'); - var post_id = $link.data('post-id'); - var message_id = $link.data('message-id'); - openerp.jsonRpc("/forum/message_delete", 'call', {}).then(function (data) { - $link.parents('#comment').remove(); + openerp.jsonRpc($link.attr('href'), 'call', {}).then(function (data) { + $link.parents('.comment').first().remove(); }); return true; }); diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index fdd245be23d..a412d114724 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -537,9 +537,11 @@