Skip to content

Commit

Permalink
fixed code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii-Midianyi committed Dec 14, 2023
1 parent 97cd968 commit 6f36ab0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package greencity.constant;

public final class EmailNotificationMessagesConstants {

private EmailNotificationMessagesConstants(){}
public static final String ECONEWS_CREATION_SUBJECT = "You have created eco news";
public static final String ECONEWS_CREATION_MESSAGE = "you successfully created eco news ";
public static final String ECONEWS_LIKE_SUBJECT = "Your news received a like";
Expand Down
12 changes: 6 additions & 6 deletions service/src/main/java/greencity/service/EventServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ public void delete(Long eventId, String email) {
emailThreadPool.submit(() -> {
try {
RequestContextHolder.setRequestAttributes(originalRequestAttributes);
attendersEmails.forEach(attenderEmail -> {
attendersEmails.forEach(attenderEmail ->
notificationService.sendEmailNotification(
GeneralEmailMessage.builder()
.email(attenderEmail)
.subject(EmailNotificationMessagesConstants.EVENT_CANCELED_SUBJECT)
.message(
EmailNotificationMessagesConstants.EVENT_CANCELED_MESSAGE + toDelete.getTitle())
.build());
});
.build())
);
} finally {
RequestContextHolder.resetRequestAttributes();
}
Expand Down Expand Up @@ -490,14 +490,14 @@ public EventDto update(UpdateEventDto eventDto, String email, MultipartFile[] im
emailThreadPool.submit(() -> {
try {
RequestContextHolder.setRequestAttributes(originalRequestAttributes);
attendersEmails.forEach(attenderEmail -> {
attendersEmails.forEach(attenderEmail ->
notificationService.sendEmailNotification(
GeneralEmailMessage.builder()
.email(attenderEmail)
.subject(EmailNotificationMessagesConstants.EVENT_UPDATED_SUBJECT)
.message(EmailNotificationMessagesConstants.EVENT_UPDATED_MESSAGE + toUpdate.getTitle())
.build());
});
.build())
);
} finally {
RequestContextHolder.resetRequestAttributes();
}
Expand Down

0 comments on commit 6f36ab0

Please sign in to comment.