diff --git a/src/main/java/com/chat/yourway/service/ContactService.java b/src/main/java/com/chat/yourway/service/ContactService.java index 67de683..ec9fff8 100644 --- a/src/main/java/com/chat/yourway/service/ContactService.java +++ b/src/main/java/com/chat/yourway/service/ContactService.java @@ -153,6 +153,7 @@ private void changePermissionSendingPrivateMessages(String email, boolean isPerm email, isPermittedSendingPrivateMessage); } + @Transactional public void addUnreadMessageToTopicSubscribers(Contact excludeСontact, Message message) { List topicSubscribers = message.getTopic().getTopicSubscribers() .stream() @@ -164,11 +165,13 @@ public void addUnreadMessageToTopicSubscribers(Contact excludeСontact, Message } } + @Transactional public void deleteUnreadMessage(Contact contact, Message message) { contact.getUnreadMessages().remove(message); save(contact); } + @Transactional public Contact getCurrentContact() { try { Contact principal = (Contact) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); diff --git a/src/main/java/com/chat/yourway/service/TopicService.java b/src/main/java/com/chat/yourway/service/TopicService.java index 344f95b..ee37ae5 100644 --- a/src/main/java/com/chat/yourway/service/TopicService.java +++ b/src/main/java/com/chat/yourway/service/TopicService.java @@ -272,8 +272,7 @@ private void validateRecipientEmail(String sendTo) { if (!contactService.isEmailExists(sendTo)) { log.error("Private topic cannot be created, recipient email={} does not exist", sendTo); throw new ContactEmailNotExist(String.format( - "Private topic cannot be created because recipient email: %s does not exist", - sendTo)); + "Private topic cannot be created because recipient email: %s does not exist", sendTo)); } } }