summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiral Bhavsar <hbh@odoo.com>2018-01-25 15:19:32 +0530
committerJeremy Kersten <jke@odoo.com>2018-04-09 21:57:43 +0200
commit5cafed7fab4492211e9aa32daa5f55e73f3e8390 (patch)
treea7a36cae885e2be3b83b7d4a3abf9be8c8436302
parentbae90d81df7fa0bd229ac042d58ec5a8e4e2bb3b (diff)
[IMP] website_forum: better management of archived forum
Before this commit, badge, user,... was available when a forum is archived. Now we display a msg to explain to the user that the forum has been archived. Related to task-33955
-rw-r--r--addons/website_forum/controllers/main.py3
-rw-r--r--addons/website_forum/views/website_forum.xml11
2 files changed, 13 insertions, 1 deletions
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py
index ac84166d528..4e493e5017e 100644
--- a/addons/website_forum/controllers/main.py
+++ b/addons/website_forum/controllers/main.py
@@ -234,6 +234,9 @@ class WebsiteForum(http.Controller):
@http.route(['''/forum/<model("forum.forum"):forum>/question/<model("forum.post", "[('forum_id','=',forum[0]),('parent_id','=',False),('can_view', '=', True)]"):question>'''], type='http', auth="public", website=True)
def question(self, forum, question, **post):
+ if not forum.active:
+ return request.render("website_forum.header", {'forum': forum})
+
# Hide posts from abusers (negative karma), except for moderators
if not question.can_view:
raise werkzeug.exceptions.NotFound()
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml
index 8fd82a76b6d..3fc580ef4a5 100644
--- a/addons/website_forum/views/website_forum.xml
+++ b/addons/website_forum/views/website_forum.xml
@@ -51,7 +51,7 @@
<!-- Page Index -->
<template id="header" name="Forum Index">
- <t t-call="website_forum.layout">
+ <t t-if="forum.active" t-call="website_forum.layout">
<div t-if="is_public_user and not forum_welcome_message" class="forum_intro">
<div t-field="forum.welcome_message"/>
</div>
@@ -218,6 +218,14 @@
</div>
<div class="oe_structure"/>
</t>
+ <t t-else="" t-call="website_forum.layout">
+ <t t-set='head'>
+ <meta name="robots" content="noindex, nofollow" />
+ </t>
+ <div class="text-center text-muted">
+ <p class="css_editable_hidden"><h2>This forum has been archived.</h2></p>
+ </div>
+ </t>
</template>
<!-- Template use to edit the welcome_message -->
@@ -387,6 +395,7 @@
<div class="container">
<h1 class="mb32">Our forums</h1>
<div class="row">
+ <div t-if="not forums" class="well">No forum post yet.</div>
<div t-foreach="forums" t-as="forum" class="col-sm-3 text-center mb32">
<a t-attf-href="/forum/#{ slug(forum) }">
<div class="fa fa-5x fa-comment mb16"/>