From cc46cb641ff0fc47cf07157ad78f6b25d3b08ea2 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Fri, 15 Sep 2023 09:46:25 +0100 Subject: [PATCH] feat: Add Perks Notification Type - MEED-2450 - Meeds-io/MIPs#80 (#414) --- .../notification/RewardSuccessTemplateBuilder.java | 4 ---- .../builder/RequestFundsTemplateBuilder.java | 3 --- .../wallet/notification/builder/TemplateBuilder.java | 2 -- .../notification/WalletNotification_en.properties | 2 ++ .../vue-app/notification-extension/extensions.js | 11 +++++++++++ 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java b/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java index bf542410bc..4c8b03a7bd 100644 --- a/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java +++ b/wallet-reward-services/src/main/java/org/exoplatform/wallet/reward/notification/RewardSuccessTemplateBuilder.java @@ -28,7 +28,6 @@ import org.apache.commons.codec.binary.StringUtils; import org.exoplatform.commons.api.notification.NotificationContext; -import org.exoplatform.commons.api.notification.NotificationMessageUtils; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; import org.exoplatform.commons.api.notification.model.*; import org.exoplatform.commons.api.notification.service.template.TemplateContext; @@ -86,9 +85,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { String rewardEndPeriodDate = (String) templateContext.get(REWARD_END_PERIOD_DATE); templateContext.put(REWARD_END_PERIOD_DATE_FORMATTED, formatTime(Long.parseLong(rewardEndPeriodDate) - 1, zoneId, language)); - String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey()); - templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread"); - setLastModifiedDate(notification, language, templateContext); SocialNotificationUtils.addFooterAndFirstName(notification.getTo(), templateContext); diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java index cfa8dc1a29..f4cef388f4 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/RequestFundsTemplateBuilder.java @@ -23,7 +23,6 @@ import java.util.Locale; import org.exoplatform.commons.api.notification.NotificationContext; -import org.exoplatform.commons.api.notification.NotificationMessageUtils; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; import org.exoplatform.commons.api.notification.channel.template.TemplateProvider; import org.exoplatform.commons.api.notification.model.MessageInfo; @@ -82,7 +81,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { String userUrl = notification.getValueOwnerParameter(USER_URL); String symbol = notification.getValueOwnerParameter(SYMBOL); String message = notification.getValueOwnerParameter(MESSAGE); - String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey()); String fundRequestSent = notification.getValueOwnerParameter(FUNDS_REQUEST_SENT); RequestLifeCycle.begin(container); @@ -100,7 +98,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { templateContext.put("MESSAGE", message); templateContext.put("AVATAR", avatar != null ? avatar : LinkProvider.PROFILE_DEFAULT_AVATAR_URL); templateContext.put("NOTIFICATION_ID", notification.getId()); - templateContext.put("READ", Boolean.parseBoolean(notificationRead) ? "read" : "unread"); templateContext.put("FUNDS_REQUEST_SENT", Boolean.valueOf(fundRequestSent)); setLastModifiedDate(notification, language, templateContext); SocialNotificationUtils.addFooterAndFirstName(notification.getTo(), templateContext); diff --git a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java index 28397adb71..47739d5f25 100644 --- a/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java +++ b/wallet-services/src/main/java/org/exoplatform/wallet/notification/builder/TemplateBuilder.java @@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils; import org.exoplatform.commons.api.notification.NotificationContext; -import org.exoplatform.commons.api.notification.NotificationMessageUtils; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; import org.exoplatform.commons.api.notification.channel.template.TemplateProvider; import org.exoplatform.commons.api.notification.model.MessageInfo; @@ -83,7 +82,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { String symbol = notification.getValueOwnerParameter(SYMBOL); String message = notification.getValueOwnerParameter(MESSAGE); String hash = notification.getValueOwnerParameter(HASH); - String notificationRead = notification.getValueOwnerParameter(NotificationMessageUtils.READ_PORPERTY.getKey()); RequestLifeCycle.begin(container); try { diff --git a/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties b/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties index 59ef919af3..2427f5f9f7 100644 --- a/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties +++ b/wallet-services/src/main/resources/locale/notification/WalletNotification_en.properties @@ -16,6 +16,8 @@ # UINotification.label.group.Wallet=Wallet +Notification.label.types.wallet=Wallet + UINotification.title.EtherSenderNotificationPlugin=Funds sent UINotification.label.EtherSenderNotificationPlugin=Sending funds notification Notification.subject.EtherSenderNotificationPlugin=You have sent funds diff --git a/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js b/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js index 781510fadc..f07779755c 100644 --- a/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js +++ b/wallet-webapps/src/main/webapp/vue-app/notification-extension/extensions.js @@ -17,6 +17,17 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +extensionRegistry.registerExtension('WebNotification', 'notification-group-extension', { + rank: 60, + name: 'wallet', + plugins: [ + 'FundsRequestNotificationPlugin', + 'EtherReceiverNotificationPlugin', + 'EtherSenderNotificationPlugin', + 'RewardSuccessNotificationPlugin' + ], + icon: 'fa-wallet', +}); extensionRegistry.registerExtension('WebNotification', 'notification-content-extension', { type: 'FundsRequestNotificationPlugin', rank: 10,