From ff76d9ff8aa75242b208786240adc10b06a02ec6 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Tue, 25 Mar 2014 12:36:48 +0530 Subject: [PATCH] [IMP] improved code to redirect to the login when user click on convert to comment/answer if not logged in bzr revid: tpa@tinyerp.com-20140325070648-uhyr841iiahnrbz0 --- addons/website_forum/controllers/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 5e2256173e2..02d4c21213d 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -559,16 +559,22 @@ class website_forum(http.Controller): }, context=context) return werkzeug.utils.redirect("/forum/%s/user/%s" % (slug(forum),post.get('user_id'))) - @http.route('/forum//post//commet//converttoanswer', type='http', auth="user", multilang=True, website=True) + @http.route('/forum//post//commet//converttoanswer', type='http', auth="public", multilang=True, website=True) def convert_to_answer(self, forum, post, comment, **kwarg): + if not request.session.uid: + return login_redirect() + values = { 'answer_content': comment.body, } request.registry['mail.message'].unlink(request.cr, request.uid, [comment.id], context=request.context) return self.post_answer(forum, post.parent_id and post.parent_id.id or post.id, **values) - @http.route('/forum//post//converttocomment', type='http', auth="user", multilang=True, website=True) + @http.route('/forum//post//converttocomment', type='http', auth="public", multilang=True, website=True) def convert_to_comment(self, forum, post, **kwarg): + if not request.session.uid: + return login_redirect() + values = { 'comment': html2plaintext(post.content), }