Skip to content

Commit

Permalink
[FIX] website_forum: allow new user to see own pending post
Browse files Browse the repository at this point in the history
How to reproduce the bug:
------------------------

- Create a new user
- Log in as that user
- Go to a forum that don't require karma to ask a question.
- Create a new post
- On validation, you'll end up on a 404 page.

If we use the portal user instead, we see the post with a banner explaining
it has to be validated. This should be the result here too.

Specifications:
--------------

- When new users (karma = 0) create a post, redirect them to the page
relating to their question.

task-3372016

closes odoo#130857

X-original-commit: 9f62479
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
  • Loading branch information
lm4649 committed Aug 7, 2023
1 parent 444d20b commit 6c3c4fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/website_forum/models/forum_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _compute_post_karma_rights(self):
post.can_downvote = is_admin or user.karma >= post.forum_id.karma_downvote or post.user_vote == 1
post.can_comment = is_admin or user.karma >= post.karma_comment
post.can_comment_convert = is_admin or user.karma >= post.karma_comment_convert
post.can_view = is_admin or user.karma >= post.karma_close or (post_sudo.create_uid.karma > 0 and (post_sudo.active or post_sudo.create_uid == user))
post.can_view = post.can_close or post_sudo.active and (post_sudo.create_uid.karma > 0 or post_sudo.create_uid == user)
post.can_display_biography = is_admin or (post_sudo.create_uid.karma >= post.forum_id.karma_user_bio and post_sudo.create_uid.website_published)
post.can_post = is_admin or user.karma >= post.forum_id.karma_post
post.can_flag = is_admin or user.karma >= post.forum_id.karma_flag
Expand Down

0 comments on commit 6c3c4fe

Please sign in to comment.