From e7ea924697d244dd1d94855693caaa50882e7d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 19 May 2014 13:50:51 +0200 Subject: [PATCH 1/3] [FIX] website_forum: do not display closed of offensive questions in searches. Users can still go on the question using their direct link. --- addons/website_forum/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 69a420be320..cb9a79edb27 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -96,7 +96,7 @@ class WebsiteForum(http.Controller): Post = request.registry['forum.post'] user = request.registry['res.users'].browse(cr, uid, uid, context=context) - domain = [('forum_id', '=', forum.id), ('parent_id', '=', False)] + domain = [('forum_id', '=', forum.id), ('parent_id', '=', False), ('state', '=', 'active')] if search: domain += ['|', ('name', 'ilike', search), ('content', 'ilike', search)] if tag: @@ -123,7 +123,7 @@ class WebsiteForum(http.Controller): url = "/forum/%s/%s/questions" % (slug(forum), slug(tag)) else: url = "/forum/%s" % slug(forum) - + url_args = {} if search: url_args['search'] = search From 08285450908168d39f0de0d38d7055ee830732ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 19 May 2014 14:40:24 +0200 Subject: [PATCH 2/3] [IMP] website_forum: display only the 100 last activities + order by date desc --- addons/website_forum/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index cb9a79edb27..23a7b9ad538 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -535,7 +535,7 @@ class WebsiteForum(http.Controller): #activity by user. model, comment = Data.get_object_reference(cr, uid, 'mail', 'mt_comment') - activity_ids = Activity.search(cr, uid, [('res_id', 'in', user_post_ids), ('model', '=', 'forum.post'), ('subtype_id', '!=', comment)], context=context) + activity_ids = Activity.search(cr, uid, [('res_id', 'in', user_post_ids), ('model', '=', 'forum.post'), ('subtype_id', '!=', comment)], order='date DESC', limit=100, context=context) activities = Activity.browse(cr, uid, activity_ids, context=context) posts = {} From 844cf8d5657c60288f98238de0d30b98b5634685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 19 May 2014 14:40:55 +0200 Subject: [PATCH 3/3] [FIX] website_forum: fixed crash when displaying a closed question for public users; indeed partner data was displayed without using the contact widget. --- addons/website_forum/views/website_forum.xml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 66b13026335..0f132c48420 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -434,16 +434,18 @@ [Deleted] [Closed] -