diff options
author | Vitaly Takmazov | 2022-12-31 01:32:42 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-31 01:32:42 +0300 |
commit | bf5550b515c305c017cf8b3fcf04976d74314233 (patch) | |
tree | 7da644034410ee138dc821a6f0f30194a2cd0859 /src/main/java/com/juick/www | |
parent | 47bdad85f7ac2b12daf1da4e340be902a568d976 (diff) |
PMQueriesService -> ChatService
Diffstat (limited to 'src/main/java/com/juick/www')
-rw-r--r-- | src/main/java/com/juick/www/api/PM.java | 10 | ||||
-rw-r--r-- | src/main/java/com/juick/www/controllers/Site.java | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/juick/www/api/PM.java b/src/main/java/com/juick/www/api/PM.java index 55c1f2d09..96387dced 100644 --- a/src/main/java/com/juick/www/api/PM.java +++ b/src/main/java/com/juick/www/api/PM.java @@ -26,7 +26,7 @@ import com.juick.util.HttpBadRequestException; import com.juick.util.HttpForbiddenException; import com.juick.util.WebUtils; import com.juick.www.WebApp; -import com.juick.service.PMQueriesService; +import com.juick.service.ChatService; import com.juick.service.UserService; import com.juick.service.component.SystemEvent; import com.juick.service.security.annotation.Visitor; @@ -49,7 +49,7 @@ public class PM { @Inject private UserService userService; @Inject - private PMQueriesService pmQueriesService; + private ChatService chatService; @Inject private ApplicationEventPublisher applicationEventPublisher; @Inject @@ -68,7 +68,7 @@ public class PM { throw new HttpBadRequestException(); } - List<Message> msgs = pmQueriesService.getPMMessages(visitor.getUid(), uid); + List<Message> msgs = chatService.getChat(visitor.getUid(), uid); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarUrl(m.getUser()))); return msgs; } @@ -91,7 +91,7 @@ public class PM { throw new HttpForbiddenException(); } - if (pmQueriesService.createPM(visitor.getUid(), userTo.getUid(), body)) { + if (chatService.createMessage(visitor.getUid(), userTo.getUid(), body)) { Message jmsg = new Message(); jmsg.setUser(visitor); jmsg.setText(body); @@ -111,7 +111,7 @@ public class PM { @RequestParam(defaultValue = "5") int cnt) { // TODO: ignore cnt param for now but make sure paging param will not be cnt - List<Chat> lastconv = pmQueriesService.getLastChats(visitor); + List<Chat> lastconv = chatService.getLastChats(visitor); lastconv.forEach(c -> c.setAvatar(webApp.getAvatarUrl(c))); PrivateChats pms = new PrivateChats(); pms.setUsers(lastconv); diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java index dadf7ed6f..f45fe8f2d 100644 --- a/src/main/java/com/juick/www/controllers/Site.java +++ b/src/main/java/com/juick/www/controllers/Site.java @@ -74,7 +74,7 @@ public class Site { @Inject private MessagesService messagesService; @Inject - private PMQueriesService pmQueriesService; + private ChatService chatService; @Inject private WebApp webApp; @Inject @@ -455,7 +455,7 @@ public class Site { protected String doGetInbox(@Visitor User visitor, ModelMap model) { visitor.setAvatar(webApp.getAvatarWebPath(visitor)); String title = "PM: Inbox"; - List<Message> msgs = pmQueriesService.getLastPMInbox(visitor.getUid()); + List<Message> msgs = chatService.getInbox(visitor.getUid()); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser()))); fillUserModel(model, visitor, visitor); model.addAttribute("title", title); @@ -469,7 +469,7 @@ public class Site { protected String doGetSent(@Visitor User visitor, @RequestParam(required = false) String uname, ModelMap model) { visitor.setAvatar(webApp.getAvatarWebPath(visitor)); String title = "PM: Sent"; - List<Message> msgs = pmQueriesService.getLastPMSent(visitor.getUid()); + List<Message> msgs = chatService.getOutbox(visitor.getUid()); msgs.forEach(m -> m.getUser().setAvatar(webApp.getAvatarWebPath(m.getUser()))); if (WebUtils.isNotUserName(uname)) { uname = StringUtils.EMPTY; |