The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-livechat/.app/client/views/avatar.js

23 lines
664 B

import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import visitor from '../../imports/client/visitor';
Template.avatar.helpers({
imageUrl() {
let { username } = this;
if (!username && this.userId) {
const user = Meteor.users.findOne(this.userId, { fields: { username: 1 } });
username = user && user.username;
}
const currentUser = visitor.getData();
if (!username || (currentUser && currentUser.username === username)) {
return;
}
Session.get(`avatar_random_${ username }`);
return `background-image:url(${ getAvatarUrlFromUsername(username) });`;
},
});