From 093dd11c299591b9ec27e9d3c7394eeacc6f2788 Mon Sep 17 00:00:00 2001
From: Andreas Svanberg <andreass@dsv.su.se>
Date: Tue, 18 Feb 2025 14:37:10 +0100
Subject: [PATCH] Send notifications to opponents when they're approved

---
 .../se/su/dsv/scipro/notifications/Notifications.java  | 10 ++++++++++
 .../scipro/notifications/dataobject/SeminarEvent.java  |  1 +
 .../dsv/scipro/notifications/notifications.properties  |  2 ++
 .../se/su/dsv/scipro/wicket-package.utf8.properties    |  1 +
 4 files changed, 14 insertions(+)

diff --git a/core/src/main/java/se/su/dsv/scipro/notifications/Notifications.java b/core/src/main/java/se/su/dsv/scipro/notifications/Notifications.java
index 2a70b78765..55dd6be255 100644
--- a/core/src/main/java/se/su/dsv/scipro/notifications/Notifications.java
+++ b/core/src/main/java/se/su/dsv/scipro/notifications/Notifications.java
@@ -11,6 +11,7 @@ import se.su.dsv.scipro.finalseminar.FinalSeminarCreatedEvent;
 import se.su.dsv.scipro.finalseminar.FinalSeminarDeletedEvent;
 import se.su.dsv.scipro.finalseminar.FinalSeminarThesisDeletedEvent;
 import se.su.dsv.scipro.finalseminar.FinalSeminarThesisUploadedEvent;
+import se.su.dsv.scipro.finalseminar.OppositionApprovedEvent;
 import se.su.dsv.scipro.finalseminar.OppositionFailedEvent;
 import se.su.dsv.scipro.finalseminar.OppositionReportImprovementsRequestedEvent;
 import se.su.dsv.scipro.finalseminar.ParticipationFailedEvent;
@@ -170,6 +171,15 @@ public class Notifications {
         );
     }
 
+    @Subscribe
+    public void oppositionApproved(OppositionApprovedEvent event) {
+        notificationController.notifySeminar(
+            event.getFinalSeminar(),
+            SeminarEvent.Event.OPPOSITION_APPROVED,
+            new NotificationSource()
+        );
+    }
+
     @Subscribe
     public void oppositionReportImprovementsRequested(OppositionReportImprovementsRequestedEvent event) {
         Member recipient = new Member(event.opposition().getUser(), Member.Type.OPPONENT);
diff --git a/core/src/main/java/se/su/dsv/scipro/notifications/dataobject/SeminarEvent.java b/core/src/main/java/se/su/dsv/scipro/notifications/dataobject/SeminarEvent.java
index 6576f98709..4a655018f1 100755
--- a/core/src/main/java/se/su/dsv/scipro/notifications/dataobject/SeminarEvent.java
+++ b/core/src/main/java/se/su/dsv/scipro/notifications/dataobject/SeminarEvent.java
@@ -28,6 +28,7 @@ public class SeminarEvent extends NotificationEvent {
         CANCELLED,
         OPPOSITION_REPORT_SUBMITTED,
         OPPOSITION_REPORT_IMPROVEMENTS_REQUESTED,
+        OPPOSITION_APPROVED,
     }
 
     @Basic
diff --git a/core/src/main/java/se/su/dsv/scipro/notifications/notifications.properties b/core/src/main/java/se/su/dsv/scipro/notifications/notifications.properties
index 206a630073..c754728273 100755
--- a/core/src/main/java/se/su/dsv/scipro/notifications/notifications.properties
+++ b/core/src/main/java/se/su/dsv/scipro/notifications/notifications.properties
@@ -146,6 +146,8 @@ FINAL_SEMINAR.OPPOSITION_REPORT_IMPROVEMENTS_REQUESTED.title = Opposition report
 FINAL_SEMINAR.OPPOSITION_REPORT_IMPROVEMENTS_REQUESTED.body = The supervisor has deemed that the opposition report submitted \
   does not meet the minimum requirements and has requested improvements. Please log into SciPro and submit a new \
   opposition report. Their comments can be seen below:\n\n{0}
+FINAL_SEMINAR.OPPOSITION_APPROVED.title = Opposition approved
+FINAL_SEMINAR.OPPOSITION_APPROVED.body = Your opposition report has been approved by the final seminar supervisor.
 FINAL_SEMINAR.compilationSuffix = , project: {0}
 
 PEER.REVIEW_COMPLETED.title = Peer review completed
diff --git a/view/src/main/java/se/su/dsv/scipro/wicket-package.utf8.properties b/view/src/main/java/se/su/dsv/scipro/wicket-package.utf8.properties
index 01b1039371..8a9ded9954 100644
--- a/view/src/main/java/se/su/dsv/scipro/wicket-package.utf8.properties
+++ b/view/src/main/java/se/su/dsv/scipro/wicket-package.utf8.properties
@@ -85,6 +85,7 @@ SeminarEvent.THESIS_UPLOAD_REMIND = Authors reminded to upload final seminar the
 SeminarEvent.CANCELLED = Final seminar cancelled.
 SeminarEvent.OPPOSITION_REPORT_SUBMITTED = Opposition report submitted.
 SeminarEvent.OPPOSITION_REPORT_IMPROVEMENTS_REQUESTED = Opposition report improvements requested.
+SeminarEvent.OPPOSITION_APPROVED = Opposition approved.
 
 IdeaEvent.STATUS_CHANGE = Idea status changed.
 IdeaEvent.PARTNER_ACCEPT = Partner (author) accepted partnering idea.