From a695bb077af4f34bd0a085fe077bee39d0fa5d1e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 4 Dec 2023 07:39:21 +0300 Subject: Increase message editing window to 3 days --- src/main/java/com/juick/service/MessagesServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/juick') diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index 8b729c60..454b2aa0 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -1082,7 +1082,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ @Override public boolean updateMessage(Integer mid, Integer rid, String body, boolean foreign) { Instant now = Instant.now(); - Instant messageEditingWindow = now.minus(15, ChronoUnit.MINUTES); + Instant messageEditingWindow = now.minus(3, ChronoUnit.DAYS); + Instant replyEditingWindow = now.minus(15, ChronoUnit.MINUTES); if (rid == 0) { Optional message = getMessage(mid); if (message.isPresent()) { @@ -1101,7 +1102,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 || foreign) { + if (ts.compareTo(replyEditingWindow) >= 0 || foreign) { return namedParameterJdbcTemplate.update( "UPDATE replies SET txt=:txt, updated_at=:now WHERE message_id=:mid AND reply_id=:rid", new MapSqlParameterSource() -- cgit v1.2.3