[MERGE] [FIX] website_forum:
- fixed crash when displaying a closed question for public users; indeed partner data was displayed without using the contact widget - display only the 100 last activities + order by date desc - do not display closed of offensive questions in searches. Users can still go on the question using their direct link.
This commit is contained in:
commit
f037a009cc
|
@ -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
|
||||
|
@ -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 = {}
|
||||
|
|
|
@ -434,16 +434,18 @@
|
|||
<span t-if="not question.active"><b> [Deleted]</b></span>
|
||||
<span t-if="question.state == 'close'"><b> [Closed]</b></span>
|
||||
</h1>
|
||||
<div class="alert alert-info" t-if="question.state == 'close'">
|
||||
<p class="mt32 mb16 text-center">
|
||||
<b>The question has been closed for reason: <i t-esc="question.closed_reason_id.name"/>
|
||||
<br/>
|
||||
<t t-if="question.closed_uid">
|
||||
<i>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(question.closed_uid) }" t-field="question.closed_uid"/> </i>
|
||||
</t>
|
||||
on <span t-field="question.closed_date"/></b>
|
||||
<div class="alert alert-info text-center" t-if="question.state == 'close'">
|
||||
<p class="mt16">
|
||||
<b>The question has been closed for reason: <i t-esc="question.closed_reason_id.name"/></b>
|
||||
</p>
|
||||
<div t-if="question.state == 'close' and user.karma>=500" class="mb24 text-center">
|
||||
<t t-if="question.closed_uid">
|
||||
<b>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.closed_uid.id }"
|
||||
t-field="question.closed_uid"
|
||||
t-field-options='{"widget": "contact", "fields": ["name"]}'
|
||||
style="display: inline-block;"/></b>
|
||||
</t>
|
||||
<b>on <span t-field="question.closed_date"/></b>
|
||||
<div t-if="question.state == 'close' and user.karma>=500" class="mt16 mb24 text-center">
|
||||
<t t-call="website_forum.link_button">
|
||||
<t t-set="url" t-value="'/forum/' + slug(forum) + '/question/' + slug(question) + '/reopen'"/>
|
||||
<t t-set="label" t-value="'Reopen'"/>
|
||||
|
|
Loading…
Reference in New Issue