Nickname support for the user sidebar

This commit is contained in:
Jeremy Zhang 2017-08-07 03:08:26 +00:00
parent ed327a4ad1
commit 8d707a7e15

View File

@ -403,7 +403,11 @@
$("#discord-members").append(rendered_role); $("#discord-members").append(rendered_role);
for (var j = 0; j < roleobj.members.length; j++) { for (var j = 0; j < roleobj.members.length; j++) {
var member = roleobj.members[j]; var member = roleobj.members[j];
var rendered_user = Mustache.render(template_user, {"id": member.id.toString() + "d", "username": member.username, "avatar": member.avatar_url}); var member_name = member.nick;
if (!member_name) {
member_name = member.username;
}
var rendered_user = Mustache.render(template_user, {"id": member.id.toString() + "d", "username": member_name, "avatar": member.avatar_url});
$("#discord-members").append(rendered_user); $("#discord-members").append(rendered_user);
$( "#discorduser-" + member.id.toString() + "d").click({"member_id": member.id.toString()}, function(event) { $( "#discorduser-" + member.id.toString() + "d").click({"member_id": member.id.toString()}, function(event) {
mention_member(event.data.member_id); mention_member(event.data.member_id);