Skip to content
Snippets Groups Projects
Commit 3b759f0b authored by jurgenhaas's avatar jurgenhaas
Browse files

Add image support for notifiers

parent b879912b
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,10 @@ exports.initWebApp = function(options) {
return '<a href="' + url + '">' + text + '</a>';
};
var image = function(alt, url) {
return '<img height="32px" src="' + url + '" />';
};
var getToken = function(check) {
if (check.pollerParams !== undefined && check.pollerParams.hipchat_token !== undefined && check.pollerParams.hipchat_token !== '') {
return check.pollerParams.hipchat_token;
......@@ -127,7 +131,7 @@ exports.initWebApp = function(options) {
});
dashboard.on('newTrackerItem', function(source, item) {
sendMessage(source.check, source.renderItem(item, link));
sendMessage(source.check, source.renderItem(item, link, image));
});
console.log('Enabled HipChat notifications');
......
......@@ -57,6 +57,10 @@ exports.initWebApp = function(options) {
return '[' + text + '](' + url + ')';
};
var image = function(alt, url) {
return '![' + alt + '](' + url + ')';
};
var getHook = function(check) {
if (check.pollerParams !== undefined && check.pollerParams.mattermost_hook !== undefined && check.pollerParams.mattermost_hook !== '') {
return check.pollerParams.mattermost_hook;
......@@ -118,7 +122,7 @@ exports.initWebApp = function(options) {
});
dashboard.on('newTrackerItem', function(source, item) {
sendMessage(source.check, source.renderItem(item, link));
sendMessage(source.check, source.renderItem(item, link, image));
});
console.log('Enabled Mattermost notifications');
......
......@@ -80,7 +80,7 @@ BaseTrackerSource.prototype.notifyItem = function(item) {
return 'default should be overwritten';
};
BaseTrackerSource.prototype.renderItem = function(item, linkCB) {
BaseTrackerSource.prototype.renderItem = function(item, linkCB, imageCB) {
return 'default should be overwritten';
};
......
......@@ -54,7 +54,7 @@ JiraTrackerSource.prototype.notifyItem = function(item) {
return true;
};
JiraTrackerSource.prototype.renderItem = function(item, linkCB) {
JiraTrackerSource.prototype.renderItem = function(item, linkCB, imageCB) {
return linkCB(item.key, this.url + '/browse/' + item.key) + ' ' + item.fields.summary;
};
......
......@@ -48,7 +48,7 @@ RssTrackerSource.prototype.notifyItem = function(item) {
return true;
};
RssTrackerSource.prototype.renderItem = function(item, linkCB) {
RssTrackerSource.prototype.renderItem = function(item, linkCB, imageCB) {
return item.title + ' ' + linkCB('Details', item.link);
};
......
......@@ -42,7 +42,7 @@ TeamWorkTrackerSource.prototype.notifyItem = function(item) {
};
TeamWorkTrackerSource.prototype.renderItem = function(item, linkCB) {
TeamWorkTrackerSource.prototype.renderItem = function(item, linkCB, imageCB) {
var
activitytype = item['activitytype'],// new, edited, completed, reopened
type = item['type'],// task, task_comment, file
......@@ -50,7 +50,7 @@ TeamWorkTrackerSource.prototype.renderItem = function(item, linkCB) {
extradescription = item['extradescription'],
from = item['fromusername'],
link = this.url + '/' + item['link'],
avatar = '<img height="32px" src="' + item['from-user-avatar-url'] + '" />',
avatar = imageCB('', item['from-user-avatar-url']),
action = '',
title = '',
detail = '',
......
......@@ -142,7 +142,7 @@ YouTrackTrackerSource.prototype.notifyItem = function(item) {
return !(this.hideMine && (this.getValue(item.field, 'updaterName') == this.username));
};
YouTrackTrackerSource.prototype.renderItem = function(item, linkCB) {
YouTrackTrackerSource.prototype.renderItem = function(item, linkCB, imageCB) {
return this.getValue(item.field, 'updaterFullName') + ': ' + linkCB(item.id, this.url + '/issue/' + item.id) + ' ' + this.getValue(item.field, 'summary');
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment