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.java2
-rw-r--r--src/main/java/com/juick/model/Message.java14
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java2
-rw-r--r--src/main/java/com/juick/util/MessageUtils.java2
-rw-r--r--src/main/java/com/juick/www/api/Messages.java4
5 files changed, 14 insertions, 10 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java
index d5ee0b50..566cc1fd 100644
--- a/src/main/java/com/juick/ActivityPubManager.java
+++ b/src/main/java/com/juick/ActivityPubManager.java
@@ -313,7 +313,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene
note.setTo(Collections.singletonList(profileUriBuilder.personUri(msg.getTo())));
} else {
var followers = Collections.singletonList(profileUriBuilder.followersUri(msg.getUser()));
- if (!msg.FriendsOnly) {
+ if (!msg.isFriendsOnly()) {
note.setTo(Collections.singletonList(Context.ACTIVITYSTREAMS_PUBLIC));
note.setCc(followers);
} else {
diff --git a/src/main/java/com/juick/model/Message.java b/src/main/java/com/juick/model/Message.java
index d5066af6..3c86970b 100644
--- a/src/main/java/com/juick/model/Message.java
+++ b/src/main/java/com/juick/model/Message.java
@@ -30,7 +30,6 @@ import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import javax.annotation.Nonnull;
import java.io.Serializable;
import java.net.URI;
import java.time.Instant;
@@ -59,8 +58,7 @@ public class Message implements Comparable<Message>, Serializable {
@JsonIgnore
private int privacy = 1;
@XmlTransient
- @JsonIgnore
- public boolean FriendsOnly = false;
+ private boolean friendsOnly = false;
@XmlTransient
@JsonIgnore
public boolean ReadOnly = false;
@@ -105,7 +103,7 @@ public class Message implements Comparable<Message>, Serializable {
.append("rid", rid)
.append("replyto", replyto)
.append("privacy", privacy)
- .append("FriendsOnly", FriendsOnly)
+ .append("friendsOnly", isFriendsOnly())
.append("ReadOnly", ReadOnly)
.append("Hidden", Hidden)
.append("VisitorCanComment", VisitorCanComment)
@@ -394,4 +392,12 @@ public class Message implements Comparable<Message>, Serializable {
public void setSubscribed(boolean subscribed) {
this.subscribed = subscribed;
}
+
+ public boolean isFriendsOnly() {
+ return friendsOnly;
+ }
+
+ public void setFriendsOnly(boolean friendsOnly) {
+ this.friendsOnly = friendsOnly;
+ }
}
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index 9da5c16c..fc190c97 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -88,7 +88,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
msg.setCreated(MessagesServiceImpl.this.getOffsetDateTime(rs, 7).toInstant());
msg.ReadOnly = rs.getBoolean(8);
msg.setPrivacy(rs.getInt(9));
- msg.FriendsOnly = msg.getPrivacy() < 0;
+ msg.setFriendsOnly(msg.getPrivacy() < 0);
msg.setReplies(rs.getInt(10));
msg.setAttachmentType(rs.getString(11));
msg.Hidden = rs.getBoolean(13);
diff --git a/src/main/java/com/juick/util/MessageUtils.java b/src/main/java/com/juick/util/MessageUtils.java
index 6a325c0c..ff0641ae 100644
--- a/src/main/java/com/juick/util/MessageUtils.java
+++ b/src/main/java/com/juick/util/MessageUtils.java
@@ -326,7 +326,7 @@ public class MessageUtils {
for (Tag Tag : tags)
builder.append(" *").append(Tag.getName());
- if (msg.FriendsOnly)
+ if (msg.isFriendsOnly())
builder.append(" *friends");
if (msg.ReadOnly)
builder.append(" *readonly");
diff --git a/src/main/java/com/juick/www/api/Messages.java b/src/main/java/com/juick/www/api/Messages.java
index ead2c076..ef55944b 100644
--- a/src/main/java/com/juick/www/api/Messages.java
+++ b/src/main/java/com/juick/www/api/Messages.java
@@ -21,7 +21,6 @@ import com.juick.model.Message;
import com.juick.model.Tag;
import com.juick.model.User;
import com.juick.service.activities.UpdateEvent;
-import com.juick.util.WebUtils;
import com.juick.www.WebApp;
import com.juick.model.CommandResult;
import com.juick.util.HttpBadRequestException;
@@ -43,7 +42,6 @@ import org.springframework.web.bind.annotation.*;
import javax.inject.Inject;
import java.io.IOException;
import java.util.*;
-import java.util.stream.Collectors;
/**
* @author ugnich
@@ -216,7 +214,7 @@ public class Messages {
public void togglePrivacy(@Parameter(hidden = true) User visitor, @RequestParam Integer mid) {
if (visitor.isPremium() || userService.isAdminUser(visitor)) {
var msg = messagesService.getMessage(mid).orElseThrow(HttpNotFoundException::new);
- messagesService.setFriendsOnly(mid, !msg.FriendsOnly);
+ messagesService.setFriendsOnly(mid, !msg.isFriendsOnly());
msg = messagesService.getMessage(mid).orElseThrow(HttpNotFoundException::new);
applicationEventPublisher.publishEvent(
new UpdateEvent(this, visitor, msg));