aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-10-04 16:40:13 +0300
committerGravatar Vitaly Takmazov2018-10-04 16:40:53 +0300
commitdeec8829a53e5b75a837d31c5061d5ab4ecef420 (patch)
tree1d683b8cc12ad0d8e1b833a0f1d98a3ef3294632 /juick-server/src/main/java/com/juick/service
parent50c3ab940b9c9fdf5e864d969cea25f509af14b8 (diff)
ActivityPub: handle user Delete event
Diffstat (limited to 'juick-server/src/main/java/com/juick/service')
-rw-r--r--juick-server/src/main/java/com/juick/service/ActivityPubService.java6
-rw-r--r--juick-server/src/main/java/com/juick/service/activities/ActivityListener.java2
-rw-r--r--juick-server/src/main/java/com/juick/service/activities/DeleteUserEvent.java20
3 files changed, 28 insertions, 0 deletions
diff --git a/juick-server/src/main/java/com/juick/service/ActivityPubService.java b/juick-server/src/main/java/com/juick/service/ActivityPubService.java
index 6200a75e..892022cf 100644
--- a/juick-server/src/main/java/com/juick/service/ActivityPubService.java
+++ b/juick-server/src/main/java/com/juick/service/ActivityPubService.java
@@ -50,4 +50,10 @@ public class ActivityPubService extends BaseJdbcService implements SocialService
public void removeFollower(User user, String acct) {
getJdbcTemplate().update("DELETE FROM followers WHERE user_id=? AND acct=?", user.getUid(), acct);
}
+
+ @Transactional
+ @Override
+ public void removeAccount(String acct) {
+ getJdbcTemplate().update("DELETE FROM followers WHERE acct=?", acct);
+ }
}
diff --git a/juick-server/src/main/java/com/juick/service/activities/ActivityListener.java b/juick-server/src/main/java/com/juick/service/activities/ActivityListener.java
index f89b401d..01baeea9 100644
--- a/juick-server/src/main/java/com/juick/service/activities/ActivityListener.java
+++ b/juick-server/src/main/java/com/juick/service/activities/ActivityListener.java
@@ -7,4 +7,6 @@ public interface ActivityListener {
void processFollowEvent(FollowEvent event);
@EventListener
void undoFollowEvent(UndoFollowEvent event);
+ @EventListener
+ void deleteUserEvent(DeleteUserEvent event);
}
diff --git a/juick-server/src/main/java/com/juick/service/activities/DeleteUserEvent.java b/juick-server/src/main/java/com/juick/service/activities/DeleteUserEvent.java
new file mode 100644
index 00000000..8b51da9d
--- /dev/null
+++ b/juick-server/src/main/java/com/juick/service/activities/DeleteUserEvent.java
@@ -0,0 +1,20 @@
+package com.juick.service.activities;
+
+import org.springframework.context.ApplicationEvent;
+
+public class DeleteUserEvent extends ApplicationEvent {
+ private String userUri;
+ /**
+ * Create a new ApplicationEvent.
+ *
+ * @param source the object on which the event initially occurred (never {@code null})
+ */
+ public DeleteUserEvent(Object source, String userUri) {
+ super(source);
+ this.userUri = userUri;
+ }
+
+ public String getUserUri() {
+ return userUri;
+ }
+}