From 8714ad6fe3def6971cc3e5b5d6d1ad7115d5cb58 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 26 Jan 2018 13:18:32 -0500 Subject: [PATCH] Fix NPE when app specific tokens are not enabled --- static/js/services/notification-service.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/static/js/services/notification-service.js b/static/js/services/notification-service.js index ef856e735..dc9ee3603 100644 --- a/static/js/services/notification-service.js +++ b/static/js/services/notification-service.js @@ -3,9 +3,9 @@ * in the sidebar) and provides helper methods for working with them. */ angular.module('quay').factory('NotificationService', - ['$rootScope', '$interval', 'UserService', 'ApiService', 'StringBuilderService', 'PlanService', 'UserService', 'Config', '$location', 'VulnerabilityService', + ['$rootScope', '$interval', 'UserService', 'ApiService', 'StringBuilderService', 'PlanService', 'UserService', 'Features', 'Config', '$location', 'VulnerabilityService', -function($rootScope, $interval, UserService, ApiService, StringBuilderService, PlanService, UserService, Config, $location, VulnerabilityService) { +function($rootScope, $interval, UserService, ApiService, StringBuilderService, PlanService, UserService, Features, Config, $location, VulnerabilityService) { var notificationService = { 'user': null, 'notifications': [], @@ -274,14 +274,15 @@ function($rootScope, $interval, UserService, ApiService, StringBuilderService, P notificationService.notificationClasses = notificationService.getClasses(notificationService.notifications); }); - var params = { - 'expiring': true - }; - ApiService.listAppTokens(null, params).then(function(resp) { - notificationService.expiringAppTokens = resp['tokens']; - }); + if (Features.APP_SPECIFIC_TOKENS) { + var params = { + 'expiring': true + }; + ApiService.listAppTokens(null, params).then(function(resp) { + notificationService.expiringAppTokens = resp['tokens']; + }); + } }; - notificationService.reset = function() { $interval.cancel(pollTimerHandle); pollTimerHandle = $interval(notificationService.update, 5 * 60 * 1000 /* five minutes */);