[imp]:improve activity search or improve string or remove unused string

bzr revid: ssh@tinyerp.com-20140410060400-blapg8mz6kw5bvoi
This commit is contained in:
Sunil Sharma 2014-04-10 11:34:00 +05:30
parent 1cb83cbb3b
commit 75773982a4
3 changed files with 11 additions and 9 deletions

View File

@ -257,7 +257,7 @@ class website_forum(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', '=', 'website.forum.post'), '|', ('subtype_id', '!=', comment), ('subtype_id', '=', False)], context=context)
activity_ids = Activity.search(cr, uid, [('res_id', 'in', user_post_ids), ('model', '=', 'website.forum.post'), ('subtype_id', '!=', comment)], context=context)
activities = Activity.browse(cr, uid, activity_ids, context=context)
posts = {}
@ -398,7 +398,7 @@ class website_forum(http.Controller):
'content': post.get('content'),
}
question_tags = []
if post.get('question_tag').strip('[]'):
if post.get('question_tag') and post.get('question_tag').strip('[]'):
Tag = request.registry['website.forum.tag']
tags = post.get('question_tag').strip('[]').replace('"','').split(",")
for tag in tags:

View File

@ -75,7 +75,7 @@ $(document).ready(function () {
} else if (data['error'] == 'user'){
var $warning = $('<div class="alert alert-danger alert-dismissable" id="correct_answer_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
'<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
'Sorry, You cannot choose correct answer.'+
'Sorry, the user who asked this question can only accept the answer as correct.'+
'</div>');
}
correct_answer_alert = $link.parent().find("#correct_answer_alert");

View File

@ -815,17 +815,19 @@
<div class="tab-pane" id="activity">
<ul class="list-unstyled">
<li t-foreach="activities" t-as="activity">
<span t-esc="activity.date"/>
<span t-field="activity.date" t-field-options='{"format": "short"}'/>
<span t-esc="activity.subtype_id.name" class="label label-info"/>
<t t-set="post" t-value="posts[activity.res_id]"/>
<span t-if="post[1]">
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }#answer-#{ str(post[1].id) }">
Gave an answer
</a> on
<span t-esc="post[0].name"/>
</a>
</span>
<span t-if="not post[1]">
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
<span t-esc="post[0].name"/>
</a>
</span>
<a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
<span t-esc="post[0].name"/>
</a>
</li>
</ul>
</div>