aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick')
-rw-r--r--src/main/java/com/juick/ActivityPubManager.java1
-rw-r--r--src/main/java/com/juick/util/MessageUtils.java4
-rw-r--r--src/main/java/com/juick/www/api/activity/model/Context.java1
-rw-r--r--src/main/java/com/juick/www/api/activity/model/objects/Note.java11
4 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index ad887819..8aa2ef78 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -354,6 +354,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
note.setCc(cc);
}
});
+ note.setSensitive(MessageUtils.isSensitive(msg));
if (msg.isHtml()) {
note.setContent(msg.getText());
} else {
diff --git a/src/main/java/com/juick/util/MessageUtils.java b/src/main/java/com/juick/util/MessageUtils.java
index 75a7fbf0..b0093b38 100644
--- a/src/main/java/com/juick/util/MessageUtils.java
+++ b/src/main/java/com/juick/util/MessageUtils.java
@@ -396,4 +396,8 @@ public class MessageUtils {
}
return result;
}
+
+ public static boolean isSensitive(Message msg) {
+ return msg.getTags().stream().anyMatch((t) -> t.getName().equals("NSFW"));
+ }
}
diff --git a/src/main/java/com/juick/www/api/activity/model/Context.java b/src/main/java/com/juick/www/api/activity/model/Context.java
index f41aa69c..e75f2440 100644
--- a/src/main/java/com/juick/www/api/activity/model/Context.java
+++ b/src/main/java/com/juick/www/api/activity/model/Context.java
@@ -115,6 +115,7 @@ public abstract class Context {
public static Context build(Context response) {
response.context = new ArrayList<>(Arrays.asList(ACTIVITY_STREAMS_URI, SECURITY_URI));
response.context.add(Collections.singletonMap("Hashtag", "as:Hashtag"));
+ response.context.add(Collections.singletonMap("sensitive", "as:sensitive"));
return response;
}
diff --git a/src/main/java/com/juick/www/api/activity/model/objects/Note.java b/src/main/java/com/juick/www/api/activity/model/objects/Note.java
index 8aa196a3..66470b5c 100644
--- a/src/main/java/com/juick/www/api/activity/model/objects/Note.java
+++ b/src/main/java/com/juick/www/api/activity/model/objects/Note.java
@@ -29,11 +29,12 @@ public class Note extends Context {
private List<Image> attachment;
private List<String> to;
private List<String> cc;
+ private boolean sensitive;
public String getContent() {
return content;
}
-
+
public void setContent(String content) {
this.content = content;
}
@@ -78,4 +79,12 @@ public class Note extends Context {
public void setInReplyTo(String inReplyTo) {
this.inReplyTo = inReplyTo;
}
+
+ public boolean isSensitive() {
+ return sensitive;
+ }
+
+ public void setSensitive(boolean sensitive) {
+ this.sensitive = sensitive;
+ }
}