From 6c3c4fe3701e7ad2f09a9b62d5c11fc73365e1e1 Mon Sep 17 00:00:00 2001 From: "Lopes Marc (loma)" Date: Mon, 17 Jul 2023 10:50:26 +0000 Subject: [PATCH] [FIX] website_forum: allow new user to see own pending post MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/odoo#130857 X-original-commit: 9f624795c68d69ddf212657fe43cc45fc32747a0 Signed-off-by: Stéphane Debauche (std) --- addons/website_forum/models/forum_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_forum/models/forum_post.py b/addons/website_forum/models/forum_post.py index a3ea7410731..f43f2096ca3 100644 --- a/addons/website_forum/models/forum_post.py +++ b/addons/website_forum/models/forum_post.py @@ -259,7 +259,7 @@ class Post(models.Model): 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