From 746d4b09b3aea8b30d570966d3eed6733ced3eab Mon Sep 17 00:00:00 2001 From: Lucas Welscher Date: Tue, 13 Aug 2024 15:24:10 +0200 Subject: [PATCH] `Communication`: Fix link in email notification --- .../domain/notification/NotificationTargetFactory.java | 6 +++--- .../artemis/notification/NotificationTargetFactoryTest.java | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationTargetFactory.java b/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationTargetFactory.java index 86a856dffce2..76f24a8456c4 100644 --- a/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationTargetFactory.java +++ b/src/main/java/de/tum/in/www1/artemis/domain/notification/NotificationTargetFactory.java @@ -339,11 +339,11 @@ public static String extractNotificationUrl(Notification notification, String ba * If the post is not associated with a conversation or messaging is disabled in the course, the URL leads to the communication page. * * @param post which information will be needed to create the URL - * @param baseUrl the prefix (depends on current set up (e.g. "http://localhost:9000/courses")) + * @param baseUrl the prefix (depends on current set up (e.g. "http://localhost:9000")) * @return viable URL to the notification related page */ public static String extractNotificationUrl(Post post, String baseUrl) { - // e.g. http://localhost:8080/courses/1/messages?conversationId=123 - return baseUrl + "/courses/" + post.getConversation().getCourse().getId() + "/messages?conversationId=" + post.getConversation().getId(); + // e.g. http://localhost:8080/courses/1/communication?conversationId=123 + return baseUrl + "/courses/" + post.getConversation().getCourse().getId() + "/communication?conversationId=" + post.getConversation().getId(); } } diff --git a/src/test/java/de/tum/in/www1/artemis/notification/NotificationTargetFactoryTest.java b/src/test/java/de/tum/in/www1/artemis/notification/NotificationTargetFactoryTest.java index 96b0db2daa28..c97014991558 100644 --- a/src/test/java/de/tum/in/www1/artemis/notification/NotificationTargetFactoryTest.java +++ b/src/test/java/de/tum/in/www1/artemis/notification/NotificationTargetFactoryTest.java @@ -58,8 +58,6 @@ class NotificationTargetFactoryTest { private static final String BASE_URL = "https://artemistest.ase.in.tum.de"; - private static final String MESSAGES_CONVERSATION = "messages?conversationId="; - private String resultingURL; private static final String PROBLEM_STATEMENT = "problem statement"; @@ -74,8 +72,8 @@ class NotificationTargetFactoryTest { // expected/correct URLs - // e.g. https://artemistest.ase.in.tum.de/courses/477/discussion?searchText=%232000 - private static final String EXPECTED_POST_URL = BASE_URL_COURSES_COURSE_ID + "/" + MESSAGES_CONVERSATION + CHANNEL_ID; + // e.g. https://artemistest.ase.in.tum.de/courses/477/communication?conversationId=2000 + private static final String EXPECTED_POST_URL = BASE_URL_COURSES_COURSE_ID + "/" + "communication?conversationId=" + CHANNEL_ID; // e.g. https://artemistest.ase.in.tum.de/courses/477/lectures/199 private static final String EXPECTED_ATTACHMENT_CHANGED_URL = BASE_URL_COURSES_COURSE_ID + "/" + LECTURES_TEXT + "/" + LECTURE_ID;