From a55737aab40ae7f71d05fda87dd73b25127fde15 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Fri, 2 Dec 2016 17:02:43 +0100 Subject: [PATCH] #7 Support fixed width for avatars in GitHub notifications --- plugins/mattermost/index.js | 11 +++++++++-- plugins/tracker/sources/github/githubSource.js | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/mattermost/index.js b/plugins/mattermost/index.js index 3d8eace..66e0343 100644 --- a/plugins/mattermost/index.js +++ b/plugins/mattermost/index.js @@ -57,8 +57,15 @@ exports.initWebApp = function(options) { return '[' + text + '](' + url + ')'; }; - var image = function(alt, url) { - return ''; + var image = function(alt, url, width, height) { + var size = ''; + if (width != undefined) { + size = ' =' + width + 'x'; + if (height != undefined) { + size += height; + } + } + return ''; }; var getHook = function(check) { diff --git a/plugins/tracker/sources/github/githubSource.js b/plugins/tracker/sources/github/githubSource.js index dd286fb..8e627a8 100644 --- a/plugins/tracker/sources/github/githubSource.js +++ b/plugins/tracker/sources/github/githubSource.js @@ -60,7 +60,7 @@ GitHubTrackerSource.prototype.notifyItem = function(item) { GitHubTrackerSource.prototype.renderItem = function(item, linkCB, imageCB) { var url = item.repository.html_url, - avatar = imageCB('', item.repository.owner.avatar_url), + avatar = imageCB('', item.repository.owner.avatar_url, 50), project = item.repository.full_name, title = item.subject.title, type = ''; -- GitLab