aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-12-19 13:21:40 +0300
committerGravatar Vitaly Takmazov2019-12-19 13:21:40 +0300
commit3ab17252a7d9f6c5834d85d050a19fa41be0c07d (patch)
treed6eb45b174281abfcee6e280eab7bb0f5bf15987 /src/main/java/com/juick/service
parent7b2bad85004179e7898e90e26c8afe34f221dde0 (diff)
Send Update activites on message updates
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r--src/main/java/com/juick/service/activities/ActivityListener.java3
-rw-r--r--src/main/java/com/juick/service/activities/UpdateEvent.java47
2 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/activities/ActivityListener.java b/src/main/java/com/juick/service/activities/ActivityListener.java
index d32585bb..81190ef2 100644
--- a/src/main/java/com/juick/service/activities/ActivityListener.java
+++ b/src/main/java/com/juick/service/activities/ActivityListener.java
@@ -39,4 +39,7 @@ public interface ActivityListener {
@Async
@EventListener
void undoAnnounceEvent(UndoAnnounceEvent event);
+ @Async
+ @EventListener
+ void processUpdateEvent(UpdateEvent event);
}
diff --git a/src/main/java/com/juick/service/activities/UpdateEvent.java b/src/main/java/com/juick/service/activities/UpdateEvent.java
new file mode 100644
index 00000000..0d02e80b
--- /dev/null
+++ b/src/main/java/com/juick/service/activities/UpdateEvent.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2008-2019, Juick
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package com.juick.service.activities;
+
+import com.juick.User;
+import org.springframework.context.ApplicationEvent;
+
+public class UpdateEvent extends ApplicationEvent {
+ private final User actor;
+ private final String messageUri;
+ /**
+ * Create a new {@code ApplicationEvent}.
+ *
+ * @param source the object on which the event initially occurred or with
+ * which the event is associated (never {@code null})
+ * @param actor the event author
+ * @param messageUri the object's id
+ */
+ public UpdateEvent(Object source, User actor, String messageUri) {
+ super(source);
+ this.actor = actor;
+ this.messageUri = messageUri;
+ }
+
+ public User getUser() {
+ return actor;
+ }
+
+ public String getMessageUri() {
+ return messageUri;
+ }
+}