Skip to content

Commit

Permalink
fix(gitlab: events): fix event handler author icon_url erroring
Browse files Browse the repository at this point in the history
Avatar URLs seem to be just the path, which made Discord spew out errors. Fixed!
  • Loading branch information
dsevillamartin committed Jul 13, 2017
1 parent 4dac4aa commit 9c03f81
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Gitlab/EventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ class Events {
if (embed.color) embed.color = typeof embed.color === 'string' ? parseInt(`0x${embed.color.replace(`0x`, ``)}`, 16) : embed.color;
break;
}
const avatar = data.user ? data.user.avatar_url : data.user_avatar;

embed.author = {
name: data.user ? data.user.username : data.user_name,
icon_url: data.user ? data.user.avatar_url : data.user_avatar,
icon_url: avatar && avatar.startsWith('/') ? `https://gitlab.com${avatar}` : avatar,
};
embed.footer = {
text: data.project.path_with_namespace,
Expand Down

0 comments on commit 9c03f81

Please sign in to comment.