From 8d707a7e150001a95e97f74afe79cbbb2c296ee0 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 7 Aug 2017 03:08:26 +0000 Subject: [PATCH] Nickname support for the user sidebar --- webapp/titanembeds/static/js/embed.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/titanembeds/static/js/embed.js b/webapp/titanembeds/static/js/embed.js index 72d3959..a959f87 100644 --- a/webapp/titanembeds/static/js/embed.js +++ b/webapp/titanembeds/static/js/embed.js @@ -403,7 +403,11 @@ $("#discord-members").append(rendered_role); for (var j = 0; j < roleobj.members.length; 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); $( "#discorduser-" + member.id.toString() + "d").click({"member_id": member.id.toString()}, function(event) { mention_member(event.data.member_id);