Add support for Enterprise logos in notifications

This commit is contained in:
Sam Chow 2018-05-07 11:11:33 -04:00
parent 6fe579119b
commit 84ad1d83e1
2 changed files with 8 additions and 4 deletions

View file

@ -71,8 +71,12 @@ angular.module('quay').factory('Config', ['Features', function(Features) {
return value;
};
config.getEnterpriseLogo = function() {
config.getEnterpriseLogo = function(defaultValue) {
if (!config.ENTERPRISE_LOGO_URL) {
if (defaultValue) {
return defaultValue;
}
if (Features.BILLING) {
return '/static/img/quay-horizontal-color.svg';
} else {

View file

@ -288,7 +288,6 @@ function($rootScope, $interval, UserService, ApiService, StringBuilderService, P
mostRecentTimestamp = new Date(notificationService.notifications[0].created).getTime();
}
const newNotifications = notificationService.notifications
.filter(obj => new Date(obj.created).getTime() > mostRecentTimestamp);
@ -299,8 +298,9 @@ function($rootScope, $interval, UserService, ApiService, StringBuilderService, P
}
new Notification(message, {
icon: window.location.origin + '/static/img/quay-logo.png',
image: window.location.origin + '/static/img/quay-logo.png',
// Chrome doesn't display SVGs for notifications, so we'll use a default if we don't have an enterprise logo
icon: window.location.origin + Config.getEnterpriseLogo('/static/img/quay-logo.png'),
image: window.location.origin + Config.getEnterpriseLogo('/static/img/quay-logo.png'),
});
const newTimestamp = new Date(newNotifications[0].created).getTime();