Skip to content
Permalink
Browse files

[IMP] im_livechat, web: custom placeholder image

When the user has no set any image, it now displays the default
user image placeholder instead of the image placeholder in livechat.

Task-ID 1924666
  • Loading branch information...
jso-odoo authored and alexkuhn committed Jan 30, 2019
1 parent 70606f5 commit 0ceccd04a94a5267b5a243b22457a6e97cf503d1
@@ -39,7 +39,7 @@ var WebsiteLivechatMessage = AbstractMessage.extend({
getAvatarSource: function () {
var source = this._serverURL;
if (this.hasAuthor()) {
source += '/web/image/res.partner/' + this.getAuthorID() + '/image_small';
source += '/web/image/res.partner/' + this.getAuthorID() + '/image_small?placeholder=user_placeholder.jpg';
} else {
source += '/mail/static/src/img/smiley/avatar.jpg';
}
@@ -1040,7 +1040,7 @@ def content_common(self, xmlid=None, model='ir.attachment', id=None, field='data
def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas',
filename_field='datas_fname', unique=None, filename=None, mimetype=None,
download=None, width=0, height=0, crop=False, access_token=None, avoid_if_small=False,
upper_limit=False, **kw):
upper_limit=False, placeholder='placeholder.png', **kw):
status, headers, content = request.env['ir.http'].binary_content(
xmlid=xmlid, model=model, id=id, field=field, unique=unique, filename=filename,
filename_field=filename_field, download=download, mimetype=mimetype,
@@ -1049,7 +1049,7 @@ def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas
if status == 301 or (status != 200 and download):
return request.env['ir.http']._response_by_status(status, headers, content)
if not content:
content = base64.b64encode(self.placeholder(image='placeholder.png'))
content = base64.b64encode(self.placeholder(image=placeholder))
headers = self.force_contenttype(headers, contenttype='image/png')
if not (width or height):
suffix = 'big' if field == 'image' else field.split('_')[-1]
Binary file not shown.

0 comments on commit 0ceccd0

Please sign in to comment.
You can’t perform that action at this time.