aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/MessagesServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-04 07:18:16 +0300
committerGravatar Vitaly Takmazov2023-01-04 07:18:16 +0300
commit0e20ca44eee0cb2726b575aed88a495206481973 (patch)
tree65dc225857d836eebd5acca9125fbc1cdde0c158 /src/main/java/com/juick/service/MessagesServiceImpl.java
parenta48e976347abe9e61d7b4ba61831098629aabece (diff)
ActivityPub: handle Note updates
Diffstat (limited to 'src/main/java/com/juick/service/MessagesServiceImpl.java')
-rw-r--r--src/main/java/com/juick/service/MessagesServiceImpl.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java
index 3a4c3767..68d47429 100644
--- a/src/main/java/com/juick/service/MessagesServiceImpl.java
+++ b/src/main/java/com/juick/service/MessagesServiceImpl.java
@@ -1099,14 +1099,14 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
@Transactional
@Override
- public boolean updateMessage(Integer mid, Integer rid, String body) {
+ public boolean updateMessage(Integer mid, Integer rid, String body, boolean foreign) {
Instant now = Instant.now();
Instant messageEditingWindow = now.minus(15, ChronoUnit.MINUTES);
if (rid == 0) {
Optional<Message> message = getMessage(mid);
if (message.isPresent()) {
Instant ts = message.get().getUpdatedAt();
- if (ts.compareTo(messageEditingWindow) >= 0) {
+ if (ts.compareTo(messageEditingWindow) >= 0 || foreign) {
return jdbcTemplate.update(
"UPDATE messages_txt SET txt=?, updated_at=? WHERE messages_txt.message_id=?", body,
Timestamp.from(now), mid) > 0;
@@ -1117,7 +1117,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ
Message reply = getReply(mid, rid);
if (reply != null) {
Instant ts = reply.getUpdatedAt();
- if (ts.compareTo(messageEditingWindow) >= 0) {
+ if (ts.compareTo(messageEditingWindow) >= 0 || foreign) {
return jdbcTemplate.update(
"UPDATE replies SET txt=?, updated_at=? WHERE message_id=? AND reply_id=?", body,
Timestamp.from(now), mid, rid) > 0;