[FIX] website_forum: avoid retag karma check if not change in tags
When a user attempted to edit his answer, and had not enough karma to edit the tags of the post, he was always restricted, even if he made no changes within the post tags. opw-670090
This commit is contained in:
@@ -483,7 +483,8 @@ class Post(models.Model):
|
||||
post.create_uid.sudo().add_karma(post.forum_id.karma_gen_answer_accepted * mult)
|
||||
self.env.user.sudo().add_karma(post.forum_id.karma_gen_answer_accept * mult)
|
||||
if 'tag_ids' in vals:
|
||||
if any(self.env.user.karma < post.forum_id.karma_edit_retag for post in self):
|
||||
tag_ids = set(tag.get('id') for tag in self.resolve_2many_commands('tag_ids', vals['tag_ids']))
|
||||
if any(set(post.tag_ids) != tag_ids for post in self) and any(self.env.user.karma < post.forum_id.karma_edit_retag for post in self):
|
||||
raise KarmaError(_('Not enough karma to retag.'))
|
||||
if any(key not in ['state', 'active', 'is_correct', 'closed_uid', 'closed_date', 'closed_reason_id', 'tag_ids'] for key in vals.keys()) and any(not post.can_edit for post in self):
|
||||
raise KarmaError('Not enough karma to edit a post.')
|
||||
|
||||
Reference in New Issue
Block a user