Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a link to profile to unsubscribe from emails #412

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/main/resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ user.violation.subject=You get a violation
user.violation.text=You get violation:
sincerely.yours.greenCity=Sincerely yours, Green City team.
sincerely.yours.Ubs=Sincerely yours, Pick Up City team.
unsubscribe.text=If you no longer wish to receive these emails, you can
unsubscribe=unsubscribe
unsubscribe.text=If you no longer wish to receive these emails, you can unsubscribe from them in your
unsubscribe.profile=profile
read.more=READ MORE
4 changes: 2 additions & 2 deletions core/src/main/resources/messages_uk.properties
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ user.violation.subject=\u0412\u0438\u0020\u043e\u0442\u0440\u0438\u043c\u0443\u0
user.violation.text=\u0412\u0438\u0020\u043e\u0442\u0440\u0438\u043c\u0443\u0454\u0442\u0435\u0020\u043f\u043e\u0440\u0443\u0448\u0435\u043d\u043d\u044f:
sincerely.yours.greenCity=\u0429\u0438\u0440\u043e\u0020\u0432\u0430\u0448\u0430\u002c\u0020\u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0020\u0047\u0072\u0065\u0065\u006e\u0020\u0043\u0069\u0074\u0079\u002e
sincerely.yours.Ubs=\u0429\u0438\u0440\u043e\u0020\u0432\u0430\u0448\u0430\u002c\u0020\u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0020\u0050\u0069\u0063\u006b\u0020\u0055\u0070\u0020\u0043\u0069\u0074\u0079\u002e
unsubscribe.text=\u042f\u043a\u0449\u043e \u0432\u0438 \u0431\u0456\u043b\u044c\u0448\u0435 \u043d\u0435 \u0445\u043e\u0447\u0435\u0442\u0435 \u043e\u0442\u0440\u0438\u043c\u0443\u0432\u0430\u0442\u0438 \u0440\u043e\u0437\u0441\u0438\u043b\u043a\u0443\u002c \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435
unsubscribe=\u0432\u0456\u0434\u043f\u0438\u0441\u0430\u0442\u0438\u0441\u044f
unsubscribe.text=\u042f\u043a\u0449\u043e\u0020\u0432\u0438\u0020\u0431\u0456\u043b\u044c\u0448\u0435\u0020\u043d\u0435\u0020\u0445\u043e\u0447\u0435\u0442\u0435\u0020\u043e\u0442\u0440\u0438\u043c\u0443\u0432\u0430\u0442\u0438\u0020\u0440\u043e\u0437\u0441\u0438\u043b\u043a\u0443\u002c\u0020\u0432\u0438\u0020\u043c\u043e\u0436\u0435\u0442\u0435\u0020\u0432\u0456\u0434\u043f\u0438\u0441\u0430\u0442\u0438\u0441\u044f\u0020\u0432\u0456\u0434\u0020\u043d\u0435\u0457\u0020\u0443\u0020\u0441\u0432\u043e\u0454\u043c\u0443
unsubscribe.profile=\u043f\u0440\u043e\u0444\u0456\u043b\u0456
read.more=\u0427\u0418\u0422\u0410\u0422\u0418 \u0414\u0410\u041b\u0406
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
<div class="footer">
<p>
<span th:text="#{unsubscribe.text}"></span>
<a th:text="#{unsubscribe}" th:href="${unsubscribeLink}" target="_blank"></a>.
<a th:text="#{unsubscribe.profile}" th:href="${profileLink}" target="_blank"></a>.
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<div class="footer">
<p>
<span th:text="#{unsubscribe.text}"></span>
<a th:text="#{unsubscribe}" th:href="${unsubscribeLink}" target="_blank"></a>.
<a th:text="#{unsubscribe.profile}" th:href="${profileLink}" target="_blank"></a>.
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<div class="footer">
<p>
<span th:text="#{unsubscribe.text}"></span>
<a th:text="#{unsubscribe}" th:href="${unsubscribeLink}" target="_blank"></a>.
<a th:text="#{unsubscribe.profile}" th:href="${profileLink}" target="_blank"></a>.
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class EmailConstants {
public static final String RESULT = "result";
public static final String REPORT_TYPE = "reportType";
public static final String UNSUBSCRIBE_LINK = "unsubscribeLink";
public static final String PROFILE_LINK = "profileLink";
public static final String ECO_NEWS_LIST = "ecoNewsList";
public static final String REASON = "reason";
public static final String DESCRIPTION = "description";
Expand Down
13 changes: 7 additions & 6 deletions service/src/main/java/greencity/service/EmailServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ public void sendChangePlaceStatusEmail(ChangePlaceStatusDto changePlaceStatus) {
model.put(EmailConstants.USER_NAME, changePlaceStatus.getAuthorFirstName());
model.put(EmailConstants.PLACE_NAME, changePlaceStatus.getPlaceName());
model.put(EmailConstants.STATUS, changePlaceStatus.getPlaceStatus().name());
// TODO change later
model.put(EmailConstants.UNSUBSCRIBE_LINK, "https://example.com");
model.put(EmailConstants.PROFILE_LINK, getProfileLink());

String template = createEmailTemplate(model, EmailConstants.CHANGE_PLACE_STATUS_EMAIL_PAGE);
sendEmail(changePlaceStatus.getAuthorEmail(), messageSource.getMessage(EmailConstants.CHANGE_PLACE_STATUS, null,
Expand All @@ -94,8 +93,7 @@ public void sendAddedNewPlacesReportEmail(SendReportEmailMessage message) {

for (SubscriberDto user : message.getSubscribers()) {
Map<String, Object> model = new HashMap<>(sharedModel);
// TODO change later
sharedModel.put(EmailConstants.UNSUBSCRIBE_LINK, "https://example.com");
sharedModel.put(EmailConstants.PROFILE_LINK, getProfileLink());
model.put(EmailConstants.USER_NAME, user.getName());
model.put(EmailConstants.LANGUAGE, user.getLanguage());
String template = createEmailTemplate(model, EmailConstants.NEW_PLACES_REPORT_EMAIL_PAGE);
Expand Down Expand Up @@ -296,8 +294,7 @@ public void sendScheduledNotificationEmail(ScheduledEmailMessage message) {
model.put(EmailConstants.LANGUAGE, language);
model.put(EmailConstants.TITLE, message.getSubject());
model.put(EmailConstants.BODY, message.getBody());
// TODO change later
model.put(EmailConstants.UNSUBSCRIBE_LINK, "https://example.com");
model.put(EmailConstants.PROFILE_LINK, getProfileLink());

String template = createEmailTemplate(model, EmailConstants.SCHEDULED_NOTIFICATION_PAGE);
sendEmail(message.getEmail(), message.getSubject(), template);
Expand All @@ -318,4 +315,8 @@ private Map<String, Object> buildModelMapForPasswordRestore(Long userId, String
private String getClientLinkByIsUbs(boolean isUbs) {
return clientLink + "/#" + (isUbs ? "/ubs" : "/greenCity");
}

private String getProfileLink() {
return clientLink + "/#/profile";
}
}
Loading