Skip to content

Commit

Permalink
Chatpal: Fix avatar display in results
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimpson committed May 27, 2020
1 parent 15ffb33 commit 8e73187
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/chatpal-search/client/template/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ <h2>
</h2>
<div class="chatpal-avatar">
<div class="chatpal-avatar-image"
style="background-image:url({{getAvatarUrl cleanUsername }});"></div>
style="background-image:url({{getAvatarUrl username }});"></div>
</div>
<span class="chatpal-name">{{username}}</span>
<span class="chatpal-time">{{time}}</span>
Expand Down
5 changes: 3 additions & 2 deletions app/chatpal-search/client/template/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { TAPi18n } from 'meteor/rocketchat:tap-i18n';
import { DateFormat } from '../../../lib';
import { roomTypes, getURL } from '../../../utils';
import { Subscriptions } from '../../../models';
import { getUserAvatarURL as getAvatarUrl } from '../../../utils/lib/getUserAvatarURL';

const getAvatarUrl = (username) => getURL(`/avatar/${ username }?_dc=undefined`);
const getDMUrl = (username) => getURL(`/direct/${ username }`);

Template.ChatpalSearchResultTemplate.onCreated(function() {
Expand Down Expand Up @@ -138,7 +138,8 @@ Template.ChatpalSearchSingleRoom.helpers({

Template.ChatpalSearchSingleUser.helpers({
cleanUsername() {
return this.user_username.replace(/<\/?em>/ig, '');
const username = this.user_username || this.username; // varies whether users or messages of users are displayed
return username.replace(/<\/?em>/ig, '');
},
getAvatarUrl,
getDMUrl,
Expand Down

0 comments on commit 8e73187

Please sign in to comment.