From 2b10178556730e0eebd8b91bf80858ac84f2e794 Mon Sep 17 00:00:00 2001 From: Ayoub Zayati Date: Mon, 7 Oct 2024 14:41:20 +0200 Subject: [PATCH] feat: Send published article public link in publish news mail notification message - EXO-73050 - Meeds-io/MIPs#129 (#250) --- .../news/notification/provider/MailTemplateProvider.java | 5 +---- .../news/notification/provider/MailTemplateProviderTest.java | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/content-service/src/main/java/io/meeds/news/notification/provider/MailTemplateProvider.java b/content-service/src/main/java/io/meeds/news/notification/provider/MailTemplateProvider.java index 1f80c1ec1..2d70e5bd9 100644 --- a/content-service/src/main/java/io/meeds/news/notification/provider/MailTemplateProvider.java +++ b/content-service/src/main/java/io/meeds/news/notification/provider/MailTemplateProvider.java @@ -111,8 +111,7 @@ protected MessageInfo makeMessage(NotificationContext ctx) { templateContext.put("AUTHOR_AVATAR_URL", encoder.encode(authorAvatarUrl)); templateContext.put("CONTEXT", encoder.encode(context)); StringBuilder activityUrl = new StringBuilder(); - Space space = spaceService.getSpaceByDisplayName(contentSpaceName); - if (pluginId.equals(PublishNewsNotificationPlugin.ID) && !spaceService.isMember(space, notification.getTo())) { + if (pluginId.equals(PublishNewsNotificationPlugin.ID)) { String portalName = PortalContainer.getCurrentPortalContainerName(); String portalOwner = CommonsUtils.getCurrentPortalOwner(); String currentDomain = CommonsUtils.getCurrentDomain(); @@ -125,8 +124,6 @@ protected MessageInfo makeMessage(NotificationContext ctx) { .append(portalOwner) .append("/news-detail?newsId=") .append(newsId); - } else { - activityUrl.append(activityLink); } templateContext.put("ACTIVITY_LINK", encoder.encode(activityUrl.toString())); diff --git a/content-service/src/test/java/io/meeds/news/notification/provider/MailTemplateProviderTest.java b/content-service/src/test/java/io/meeds/news/notification/provider/MailTemplateProviderTest.java index 62edf4edf..4dbcff7b3 100644 --- a/content-service/src/test/java/io/meeds/news/notification/provider/MailTemplateProviderTest.java +++ b/content-service/src/test/java/io/meeds/news/notification/provider/MailTemplateProviderTest.java @@ -153,7 +153,6 @@ public void shouldInstantiateMailTemplate() { when(encoder.encode("jean")).thenReturn("jean"); when(encoder.encode("http://localhost:8080/content/images/newsImageDefault.png")).thenReturn("http://localhost:8080/content/images/newsImageDefault.png"); when(encoder.encode("COMMENT MY NEWS")).thenReturn("COMMENT MY NEWS"); - when(encoder.encode("http://localhost:8080/portal/intranet/activity?id=39")).thenReturn("http://localhost:8080/portal/intranet/activity?id=39"); when(notification.getValueOwnerParameter("read")).thenReturn("true"); when(notification.getId()).thenReturn("NotifId123"); Date date = new Date();