aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/CommandsManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/CommandsManager.java')
-rw-r--r--src/main/java/com/juick/CommandsManager.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/com/juick/CommandsManager.java b/src/main/java/com/juick/CommandsManager.java
index 6ad19bee..0c16fbbd 100644
--- a/src/main/java/com/juick/CommandsManager.java
+++ b/src/main/java/com/juick/CommandsManager.java
@@ -25,6 +25,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -50,6 +51,7 @@ import com.juick.service.component.PingEvent;
import com.juick.service.component.SystemEvent;
import com.juick.util.HttpUtils;
import com.juick.util.MessageUtils;
+import com.juick.util.TagUtils;
import com.juick.util.annotation.UserCommand;
import com.juick.util.formatters.PlainTextFormatter;
import com.juick.www.WebApp;
@@ -122,7 +124,7 @@ public class CommandsManager {
return commandResult;
}
}
- Pair<String, List<Tag>> tags = tagService.fromString(input);
+ Pair<String, Set<Tag>> tags = tagService.fromString(input);
if (tags.getRight().size() > 5) {
return CommandResult.fromString("Sorry, 5 tags maximum.");
}
@@ -539,9 +541,11 @@ public class CommandsManager {
return CommandResult.fromString("Reply not found");
}
}
- Pair<String, List<Tag>> messageTags = tagService.fromString(txt);
+ Pair<String, Set<Tag>> messageTags = tagService.fromString(txt);
if (user.getUid() == msg.get().getUser().getUid() && rid == 0 && messageTags.getRight().size() > 0) {
- if (!CollectionUtils.isEqualCollection(tagService.updateTags(mid, messageTags.getRight()), msg.get().getTags())) {
+ var updatedTags = tagService.updateTags(mid, messageTags.getRight());
+ if (!CollectionUtils.isEqualCollection(updatedTags, msg.get().getTags())) {
+ messagesService.setReadOnly(msg.get().getMid(), TagUtils.hasTag(updatedTags, "readonly"));
return CommandResult.fromString("Tags are updated");
} else {
return CommandResult.fromString("Tags are NOT updated (5 tags maximum?)");