aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/SystemActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/www/api/SystemActivity.java')
-rw-r--r--src/main/java/com/juick/www/api/SystemActivity.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/main/java/com/juick/www/api/SystemActivity.java b/src/main/java/com/juick/www/api/SystemActivity.java
index 5a7c810f..36bc3ad4 100644
--- a/src/main/java/com/juick/www/api/SystemActivity.java
+++ b/src/main/java/com/juick/www/api/SystemActivity.java
@@ -24,9 +24,11 @@ import java.util.Collections;
import java.util.List;
public class SystemActivity {
+ private SystemActivity(ActivityType type) {
+ this.type = type;
+ }
public static SystemActivity like(User from, Message message, List<User> subscribers) {
- var like = new SystemActivity();
- like.setType(ActivityType.like);
+ var like = new SystemActivity(ActivityType.like);
like.setFrom(from);
like.setMessage(message);
like.setTo(subscribers);
@@ -34,8 +36,7 @@ public class SystemActivity {
}
public static SystemActivity message(User from, Message message, List<User> subscribers) {
- var msg = new SystemActivity();
- msg.setType(ActivityType.message);
+ var msg = new SystemActivity(ActivityType.message);
msg.setFrom(from);
msg.setMessage(message);
msg.setTo(subscribers);
@@ -43,8 +44,7 @@ public class SystemActivity {
}
public static SystemActivity read(User from, Message message) {
- var read = new SystemActivity();
- read.setType(ActivityType.message);
+ var read = new SystemActivity(ActivityType.message);
read.setFrom(from);
read.setTo(Collections.emptyList());
var msg = new Message();
@@ -57,7 +57,7 @@ public class SystemActivity {
}
public static SystemActivity follow(User from, List<User> to) {
- var follow = new SystemActivity();
+ var follow = new SystemActivity(ActivityType.follow);
follow.setFrom(from);
follow.setTo(to);
return follow;
@@ -78,10 +78,6 @@ public class SystemActivity {
return type;
}
- public void setType(ActivityType type) {
- this.type = type;
- }
-
public User getFrom() {
return from;
}