From f7eeb5c5d40648bf1e0f76dab4e68c96995872c7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 12 Nov 2018 12:10:44 +0300 Subject: api: message entities --- src/main/java/com/juick/service/MessagesServiceImpl.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/main/java/com/juick/service') diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index 0b7faf87..efe480c0 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -368,6 +368,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ final Message message = list.get(0); Map> reactionStats = updateReactionsFor(Collections.singletonList(mid)); message.setReactions(reactionStats.get(message.getMid())); + message.setEntities(MessageUtils.getEntities(message)); return message; } return null; @@ -429,6 +430,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ logger.warn("exception reading images for mid {} rid {}", msg.getMid(), msg.getRid(), e); } } + msg.setEntities(MessageUtils.getEntities(msg)); return msg; }, mid, rid); @@ -882,6 +884,8 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ msgs.sort(Comparator.comparing(item -> mids.indexOf(item.getMid()))); + msgs.forEach(i -> i.setEntities(MessageUtils.getEntities(i))); + return msgs; } return Collections.emptyList(); @@ -957,6 +961,7 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ if (replies.size() > 0) { setRead(user, mid); } + replies.forEach(i -> i.setEntities(MessageUtils.getEntities(i))); return replies; } -- cgit v1.2.3