[FIX] website_forum: deleting a comment is back and works
bzr revid: tde@openerp.com-20140411170114-po5bgwc2z2qgs8f0
This commit is contained in:
@@ -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/<model("forum.forum"):forum>/post/<model("forum.post"):post>/comment/<model("mail.message"):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
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
@@ -537,9 +537,11 @@
|
||||
<template id="post_comment">
|
||||
<div class="row clearfix">
|
||||
<div class="col-sm-10 col-sm-offset-2">
|
||||
<div t-foreach="reversed(object.website_message_ids)" t-as="message" id="comment" class="oe_comment_grey mb8">
|
||||
<div t-foreach="reversed(object.website_message_ids)" t-as="message" class="comment oe_comment_grey mb8">
|
||||
<small class="text-muted">
|
||||
<button type="button" t-if="user.partner_id.id == message.author_id.id and user.karma>=750" t-att-id="message.id" class="close comment_delete">&times;</button>
|
||||
<button type="button" t-if="user.partner_id.id == message.author_id.id and user.karma>=750"
|
||||
t-attf-href="/forum/#{slug(forum)}/post/#{slug(object)}/comment/#{slug(message)}/delete"
|
||||
class="close comment_delete">&times;</button>
|
||||
<span t-field="message.body"/>
|
||||
<a t-attf-href="/forum/#{slug(forum)}/user/#{message.id}"
|
||||
t-field="message.author_id" t-field-options='{"widget": "contact", "country_image": true, "fields": ["name", "country_id"]}'
|
||||
|
||||
Reference in New Issue
Block a user