diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-08-20 18:08:19 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-08-20 18:08:19 +0200 |
| commit | 235ed4b2c1099720a6d5cfc5ada920f19fcef315 (patch) | |
| tree | 2ddc3ae85462fe3cc6e70f9598958797695d12ff /addons/website_forum/controllers/main.py | |
| parent | c3734ec5b622085a36e94bee36f92daabbae3e34 (diff) | |
| parent | 9ad5f26b3fb98cd14527de80d19bf6554a6981e2 (diff) | |
[MERGE] forward port branch saas-12 up to 9ad5f26
Diffstat (limited to 'addons/website_forum/controllers/main.py')
| -rw-r--r-- | addons/website_forum/controllers/main.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 7ad7151938d..2294daf73de 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -319,9 +319,16 @@ class WebsiteForum(http.Controller): '/forum/<model("forum.forum"):forum>/<model("forum.post"):post_parent>/reply'], type='http', auth="user", methods=['POST'], website=True) def post_create(self, forum, post_parent=None, post_type=None, **post): - if post_type == 'question' and not post.get('post_name', '').strip(): + if post_type == 'question' and not post.get('post_name', ''): return request.render('website.http_error', {'status_code': _('Bad Request'), 'status_message': _('Title should not be empty.')}) + if post.get('content', '') == '<p><br></p>': + return werkzeug.utils.redirect("/forum/%s/question/%s?nocontent=1" % (slug(forum), post_parent and slug(post_parent))) + post_tag_ids = forum._tag_to_write_vals(post.get('post_tags', '')) + + if request.env.user.forum_waiting_posts_count: + return werkzeug.utils.redirect("/forum/%s/ask" % slug(forum)) + new_question = request.env['forum.post'].create({ 'forum_id': forum.id, 'name': post.get('post_name') or (post_parent and 'Re: %s' % (post_parent.name or '')) or '', |
