From 295b859b3bc35517aa675ddb890101f49a13ffe5 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Sun, 20 Oct 2024 16:10:16 +0100 Subject: [PATCH 1/4] feat: Update Space URL computing - Meeds-io/MIPs#150 This change will change Space URL format to reference /portal/s/SPACE_ID/ rather than using Space GROUP_ID and PRETTY_NAME which make it complex to build and not permanent as url. --- .../wallet/reward/test/mock/SpaceServiceMock.java | 10 ---------- .../permlink/plugin/WalletPermanentLinkPlugin.java | 7 +------ 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/test/mock/SpaceServiceMock.java b/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/test/mock/SpaceServiceMock.java index 8437fb36d..82ecca8ef 100644 --- a/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/test/mock/SpaceServiceMock.java +++ b/wallet-reward-services/src/test/java/org/exoplatform/wallet/reward/test/mock/SpaceServiceMock.java @@ -206,16 +206,6 @@ public void unregisterSpaceListenerPlugin(SpaceListenerPlugin spaceListenerPlugi } - public void setSpaceApplicationConfigPlugin(SpaceApplicationConfigPlugin spaceApplicationConfigPlugin) { - throw new UnsupportedOperationException(); - - } - - public SpaceApplicationConfigPlugin getSpaceApplicationConfigPlugin() { - throw new UnsupportedOperationException(); - - } - public List getAllSpaces() throws SpaceException { throw new UnsupportedOperationException(); diff --git a/wallet-services/src/main/java/io/meeds/wallet/permlink/plugin/WalletPermanentLinkPlugin.java b/wallet-services/src/main/java/io/meeds/wallet/permlink/plugin/WalletPermanentLinkPlugin.java index 28b167fd3..0d1990681 100644 --- a/wallet-services/src/main/java/io/meeds/wallet/permlink/plugin/WalletPermanentLinkPlugin.java +++ b/wallet-services/src/main/java/io/meeds/wallet/permlink/plugin/WalletPermanentLinkPlugin.java @@ -76,12 +76,7 @@ public String getDirectAccessUrl(PermanentLinkObject object) throws ObjectNotFou } public String getSpaceUrl(Space space) { - StringBuilder spaceUrl = new StringBuilder("/portal/g/"); - spaceUrl.append(space.getGroupId().replace("/", ":")) - .append("/") - .append(space.getPrettyName()) - .append("/SpaceWallet"); - return spaceUrl.toString(); + return String.format("/portal/s/%s/SpaceWallet", space.getId()); } public String getProfileUrl() { From 09e95be313414e48790f22fe4b3fc03a824fc49a Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Mon, 21 Oct 2024 10:03:37 +0100 Subject: [PATCH 2/4] feat: Delete SpaceService.getSpaceByUrl API - Meeds-io/MIPs#150 This change will delete the usage of SpaceService.getSpaceByUrl which is deleted from Social API. --- .../main/java/org/exoplatform/wallet/utils/WalletUtils.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java b/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java index e57af16c3..e51b455d5 100644 --- a/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java +++ b/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java @@ -489,10 +489,7 @@ public static Space getSpace(String id) { if (space == null) { space = spaceService.getSpaceByDisplayName(id); if (space == null) { - space = spaceService.getSpaceByUrl(id); - if (space == null) { - space = spaceService.getSpaceById(id); - } + space = spaceService.getSpaceById(id); } } } From a2573a6ed4e90df7dec6960a018eb192bebca4e6 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Mon, 21 Oct 2024 10:36:28 +0100 Subject: [PATCH 3/4] feat: Delete Space.getSpaceByDisplayName API - Meeds-io/MIPs#150 This change will delete the usage of getSpaceByDisplayName API since it's not unique anymore --- .../main/java/org/exoplatform/wallet/utils/WalletUtils.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java b/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java index e51b455d5..54ec0c175 100644 --- a/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java +++ b/wallet-api/src/main/java/org/exoplatform/wallet/utils/WalletUtils.java @@ -487,10 +487,7 @@ public static Space getSpace(String id) { if (space == null) { space = spaceService.getSpaceByGroupId("/spaces/" + id); if (space == null) { - space = spaceService.getSpaceByDisplayName(id); - if (space == null) { - space = spaceService.getSpaceById(id); - } + space = spaceService.getSpaceById(id); } } return space; From 5bf18cb6e314556d8dc13aacaa84a261d2b7bca9 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Mon, 21 Oct 2024 15:20:42 +0100 Subject: [PATCH 4/4] feat: Replace StringUtils package name - Meeds-io/MIPs#150 --- .../notification/RewardSuccessTemplateBuilder.java | 10 ++++++++-- .../wallet/test/mock/IdentityManagerMock.java | 2 +- 2 files changed, 9 insertions(+), 3 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 4c8b03a7b..b7ffa5679 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 @@ -16,7 +16,11 @@ */ package org.exoplatform.wallet.reward.notification; -import static org.exoplatform.wallet.utils.RewardUtils.*; +import static org.exoplatform.wallet.utils.RewardUtils.REWARD_END_PERIOD_DATE; +import static org.exoplatform.wallet.utils.RewardUtils.REWARD_END_PERIOD_DATE_FORMATTED; +import static org.exoplatform.wallet.utils.RewardUtils.REWARD_START_PERIOD_DATE; +import static org.exoplatform.wallet.utils.RewardUtils.REWARD_START_PERIOD_DATE_FORMATTED; +import static org.exoplatform.wallet.utils.RewardUtils.formatTime; import static org.exoplatform.wallet.utils.WalletUtils.AMOUNT; import static org.exoplatform.wallet.utils.WalletUtils.formatNumber; @@ -29,7 +33,9 @@ import org.exoplatform.commons.api.notification.NotificationContext; import org.exoplatform.commons.api.notification.channel.template.AbstractTemplateBuilder; -import org.exoplatform.commons.api.notification.model.*; +import org.exoplatform.commons.api.notification.model.ChannelKey; +import org.exoplatform.commons.api.notification.model.MessageInfo; +import org.exoplatform.commons.api.notification.model.NotificationInfo; import org.exoplatform.commons.api.notification.service.template.TemplateContext; import org.exoplatform.commons.notification.template.TemplateUtils; import org.exoplatform.container.ExoContainer; diff --git a/wallet-services/src/test/java/org/exoplatform/wallet/test/mock/IdentityManagerMock.java b/wallet-services/src/test/java/org/exoplatform/wallet/test/mock/IdentityManagerMock.java index 9f443e332..671c9487f 100644 --- a/wallet-services/src/test/java/org/exoplatform/wallet/test/mock/IdentityManagerMock.java +++ b/wallet-services/src/test/java/org/exoplatform/wallet/test/mock/IdentityManagerMock.java @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.List; -import org.apache.commons.codec.binary.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.exoplatform.commons.utils.ListAccess; import org.exoplatform.social.core.identity.IdentityProvider;