[FIX] web_forum: fix the comparison of tags ids
When checking if tags had changed, a missing .ids made it that a recordset was compared to a set of ids (integers). As a result, to make an edit the forum would always check that the user had sufficent karma to retag, even if it was not needed. opw 1866019
This commit is contained in:
@@ -502,7 +502,7 @@ class Post(models.Model):
|
||||
self.env.user.sudo().add_karma(post.forum_id.karma_gen_answer_accept * mult)
|
||||
if 'tag_ids' in vals:
|
||||
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):
|
||||
if any(set(post.tag_ids.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 trusted_keys for key in vals) 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