[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
This commit is contained in:
Hiral Bhavsar
2018-04-09 21:57:43 +02:00
committed by Jeremy Kersten
parent bae90d81df
commit 5cafed7fab
2 changed files with 13 additions and 1 deletions
+3
View File
@@ -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()
+10 -1
View File
@@ -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"/>