[FIX] website_mail_group: avoid displaying directly partner info in templates
but use the contact template that display partner-related data fetched as superuser, to avoid access right issues. Improved display: author or email-from. Fixed issues in the pager. bzr revid: tde@openerp.com-20140326103515-uzv6smwh9q6vyni9
This commit is contained in:
parent
cafaf60552
commit
f9b18d51ad
|
@ -9,7 +9,7 @@ from openerp.addons.web.http import request
|
||||||
|
|
||||||
|
|
||||||
class MailGroup(http.Controller):
|
class MailGroup(http.Controller):
|
||||||
_thread_per_page = 2
|
_thread_per_page = 10
|
||||||
|
|
||||||
def _get_archives(self, group_id):
|
def _get_archives(self, group_id):
|
||||||
MailMessage = request.registry['mail.message']
|
MailMessage = request.registry['mail.message']
|
||||||
|
@ -43,7 +43,7 @@ class MailGroup(http.Controller):
|
||||||
|
|
||||||
@http.route([
|
@http.route([
|
||||||
"/groups/<model('mail.group'):group>",
|
"/groups/<model('mail.group'):group>",
|
||||||
"/groups/<model('mail.group'):group>/page/<int:page>/"
|
"/groups/<model('mail.group'):group>/page/<int:page>"
|
||||||
], type='http', auth="public", website=True)
|
], type='http', auth="public", website=True)
|
||||||
def thread_headers(self, group, page=1, mode='thread', date_begin=None, date_end=None, **post):
|
def thread_headers(self, group, page=1, mode='thread', date_begin=None, date_end=None, **post):
|
||||||
cr, uid, context = request.cr, request.uid, request.context
|
cr, uid, context = request.cr, request.uid, request.context
|
||||||
|
@ -57,7 +57,7 @@ class MailGroup(http.Controller):
|
||||||
|
|
||||||
thread_count = thread_obj.search_count(cr, uid, domain, context=context)
|
thread_count = thread_obj.search_count(cr, uid, domain, context=context)
|
||||||
pager = request.website.pager(
|
pager = request.website.pager(
|
||||||
url='/groups/%s/' % slug(group),
|
url='/groups/%s' % slug(group),
|
||||||
total=thread_count,
|
total=thread_count,
|
||||||
page=page,
|
page=page,
|
||||||
step=self._thread_per_page,
|
step=self._thread_per_page,
|
||||||
|
|
|
@ -93,7 +93,13 @@
|
||||||
<h1 t-field="message.subject"/>
|
<h1 t-field="message.subject"/>
|
||||||
<img class="img-rounded pull-left" t-att-src="'/website/image?model=mail.message&field=author_avatar&id='+str(message.id)" style="width : 30px"/>
|
<img class="img-rounded pull-left" t-att-src="'/website/image?model=mail.message&field=author_avatar&id='+str(message.id)" style="width : 30px"/>
|
||||||
<h4 class="mt0 mb32">
|
<h4 class="mt0 mb32">
|
||||||
<span t-field="message.author_id.name"/>
|
<t t-if="message.author_id">
|
||||||
|
<span t-field="message.author_id" style="display: inline-block;" t-field-options='{
|
||||||
|
"widget": "contact",
|
||||||
|
"fields": ["name"]
|
||||||
|
}'/>
|
||||||
|
</t>
|
||||||
|
<t t-if="not message.author_id"><t t-esc="message.email_from"/></t>
|
||||||
on <span t-field="message.date"/>
|
on <span t-field="message.date"/>
|
||||||
</h4>
|
</h4>
|
||||||
<div t-raw="message.body"/>
|
<div t-raw="message.body"/>
|
||||||
|
@ -146,12 +152,19 @@
|
||||||
<h4 class="media-heading">
|
<h4 class="media-heading">
|
||||||
<a t-attf-href="/groups/#{slug(group)}/#{slug(thread)}?mode=#{mode}&date_begin=#{date_begin}&date_end=#{date_end}" t-esc="thread.description"/>
|
<a t-attf-href="/groups/#{slug(group)}/#{slug(thread)}?mode=#{mode}&date_begin=#{date_begin}&date_end=#{date_end}" t-esc="thread.description"/>
|
||||||
</h4>
|
</h4>
|
||||||
<p><small>
|
<small>
|
||||||
by <t t-esc="thread.author_id.name and thread.author_id.name or thread.email_from"/> on <t t-esc="thread.date"/><br />
|
by
|
||||||
|
<t t-if="thread.author_id">
|
||||||
|
<span t-field="thread.author_id" style="display: inline-block;" t-field-options='{
|
||||||
|
"widget": "contact",
|
||||||
|
"fields": ["name"]
|
||||||
|
}'/>
|
||||||
|
</t>
|
||||||
|
<t t-if="not thread.author_id"><t t-esc="thread.email_from"/></t>
|
||||||
<span class="fa fa-comment-o">
|
<span class="fa fa-comment-o">
|
||||||
<t t-raw="len(thread.child_ids)"/> replies
|
<t t-raw="len(thread.child_ids)"/> replies
|
||||||
</span>
|
</span>
|
||||||
</small></p>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue