From 771ee45c0d536594c753616bb10753f50bd3705e Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Wed, 7 Feb 2018 11:19:14 +0100 Subject: [PATCH] Fixes stop promotions for notifications Resolves #13021 Auditors: Test Plan: --- app/browser/api/ledgerNotifications.js | 3 ++- test/unit/app/browser/api/ledgerNotificationsTest.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/browser/api/ledgerNotifications.js b/app/browser/api/ledgerNotifications.js index ac73a70807d..3fdf8f78a01 100644 --- a/app/browser/api/ledgerNotifications.js +++ b/app/browser/api/ledgerNotifications.js @@ -364,7 +364,8 @@ const showPromotionNotification = (state) => { ( getSetting(settings.PAYMENTS_ENABLED) && !getSetting(settings.PAYMENTS_NOTIFICATIONS) - ) + ) || + !getSetting(settings.PAYMENTS_ALLOW_PROMOTIONS) ) { return } diff --git a/test/unit/app/browser/api/ledgerNotificationsTest.js b/test/unit/app/browser/api/ledgerNotificationsTest.js index 4fc0a2ba64a..fb785866c43 100644 --- a/test/unit/app/browser/api/ledgerNotificationsTest.js +++ b/test/unit/app/browser/api/ledgerNotificationsTest.js @@ -19,6 +19,7 @@ describe('ledgerNotifications unit test', function () { let paymentsNotifications let paymentsMinVisitTime = 5000 let paymentsContributionAmount = 25 + let paymentsAllowPromotions = true const defaultAppState = Immutable.fromJS({ ledger: {}, @@ -49,6 +50,8 @@ describe('ledgerNotifications unit test', function () { return paymentsMinVisitTime case settings.PAYMENTS_CONTRIBUTION_AMOUNT: return paymentsContributionAmount + case settings.PAYMENTS_ALLOW_PROMOTIONS: + return paymentsAllowPromotions } return false } @@ -591,6 +594,13 @@ describe('ledgerNotifications unit test', function () { assert(showNotificationSpy.calledOnce) }) + it('promotions are disabled, notification is not shown', function () { + paymentsAllowPromotions = false + ledgerNotificationsApi.showPromotionNotification(state) + assert(showNotificationSpy.notCalled) + paymentsAllowPromotions = true + }) + it('notification is shown', function () { ledgerNotificationsApi.showPromotionNotification(state) assert(showNotificationSpy.calledOnce)