mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00

This changes it so we only ship an avatar template down to the client it has no magic, all it knows is how to plug in size
26 lines
932 B
JavaScript
26 lines
932 B
JavaScript
import StringBuffer from 'discourse/mixins/string-buffer';
|
|
|
|
export default Ember.Component.extend(StringBuffer, {
|
|
likedUsers: Ember.computed.alias('post.likeAction.users'),
|
|
rerenderTriggers: ['likedUsers.length'],
|
|
|
|
renderString(buffer) {
|
|
const likedUsers = this.get('likedUsers');
|
|
if (likedUsers && likedUsers.length > 0) {
|
|
buffer.push("<div class='who-liked'>");
|
|
let iconsHtml = "";
|
|
likedUsers.forEach(function(u) {
|
|
iconsHtml += "<a href=\"" + Discourse.getURL("/users/") + u.get('username_lower') + "\" data-user-card=\"" + u.get('username_lower') + "\">";
|
|
iconsHtml += Discourse.Utilities.avatarImg({
|
|
size: 'small',
|
|
avatarTemplate: u.get('avatar_template'),
|
|
title: u.get('username')
|
|
});
|
|
iconsHtml += "</a>";
|
|
});
|
|
buffer.push(I18n.t('post.actions.people.like',{icons: iconsHtml}));
|
|
buffer.push("</div>");
|
|
}
|
|
}
|
|
});
|