Skip to content

Commit 539341f

Browse files
committed
Fix Bug
1 parent cb3241d commit 539341f

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

app/src/main/java/com/orange/signsatwork/biz/persistence/service/EmailService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public interface EmailService {
6464

6565
public void sendUpdateProfilUserByAdminMessage(String to, String subject, String username, String body, String messageServerType, Locale locale);
6666

67-
public void sendCommentDeleteMessage(String[] to, String subject, String userName, Date commentDate, String url, String videoName, Locale locale);
67+
public void sendCommentDeleteMessage(String[] to, String subject, String userNameDeleted, String userName, Date commentDate, String url, String videoName, Locale locale);
6868

6969
public void sendSignDefinitionMessage(String[] to, String subject, String body, String signName, String messageType, Locale locale);
7070

app/src/main/java/com/orange/signsatwork/biz/persistence/service/impl/EmailServiceImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ public void sendUpdateProfilUserByAdminMessage(String to, String subject, String
10201020
}
10211021
}
10221022

1023-
public void sendCommentDeleteMessage(String[] to, String subject, String userName, Date commentDate, String url, String videoName, Locale locale) {
1023+
public void sendCommentDeleteMessage(String[] to, String subject, String userNameDeleted, String userName, Date commentDate, String url, String videoName, Locale locale) {
10241024
InputStream imageIs = null;
10251025
String imageName;
10261026
try {
@@ -1041,7 +1041,7 @@ public void sendCommentDeleteMessage(String[] to, String subject, String userNam
10411041
helper.setSubject(subject);
10421042
helper.setFrom(adminUsername);
10431043
Context ctx = new Context(locale);
1044-
ctx.setVariable("body", messageByLocaleService.getMessage("comment_delete_body_1", new Object[]{userName, commentDate, url}));
1044+
ctx.setVariable("body", messageByLocaleService.getMessage("comment_delete_body_1", new Object[]{userName, commentDate, url, userNameDeleted}));
10451045
ctx.setVariable("imageResourceName", imageName);
10461046
ctx.setVariable("appName", appName);
10471047
String htmlContent = templateEngine.process("email-update-data-sign-by-admin", ctx);
@@ -1053,7 +1053,7 @@ public void sendCommentDeleteMessage(String[] to, String subject, String userNam
10531053
helper.addInline(imageName, imageSource, "image/png");
10541054

10551055
List<String> toList = Arrays.asList(to);
1056-
String values = adminUsername + ';' + toList.stream().collect(Collectors.joining(", ")) + ';' + videoName + ';' + userName + ';' + commentDate ;
1056+
String values = adminUsername + ';' + toList.stream().collect(Collectors.joining(", ")) + ';' + userNameDeleted + ';' + videoName + ';' + userName + ';' + commentDate ;
10571057
MessageServer messageServer = new MessageServer(new Date(), "CommentDeleteSendEmailMessage", values, ActionType.NO);
10581058
services.messageServerService().addMessageServer(messageServer);
10591059

app/src/main/java/com/orange/signsatwork/biz/webservice/controller/CommentRestController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public CommentResponseApi addComment(@PathVariable long videoId, @RequestBody Co
6060

6161
@Secured("ROLE_ADMIN")
6262
@RequestMapping(value = RestApi.WS_SEC_COMMENT, method = RequestMethod.DELETE)
63-
public CommentResponseApi deleteApiVideo(@PathVariable long signId, @PathVariable long videoId, @PathVariable long commentId, HttpServletResponse response, HttpServletRequest request, Principal principal) {
63+
public CommentResponseApi deleteComment(@PathVariable long signId, @PathVariable long videoId, @PathVariable long commentId, HttpServletResponse response, HttpServletRequest request, Principal principal) {
6464
CommentResponseApi commentResponseApi = new CommentResponseApi();
65-
User admin = services.user().getAdmin();
65+
User user = services.user().withUserName(principal.getName());
6666
List<String> emails = new ArrayList<>();
6767
String videoName;
6868
Sign sign = services.sign().withId(signId);
@@ -83,14 +83,14 @@ public CommentResponseApi deleteApiVideo(@PathVariable long signId, @PathVariabl
8383
String title, bodyMail;
8484
final String url = getAppUrl() + "/sign/" + sign.id + "/" + video.id;
8585
title = messageByLocaleService.getMessage("comment_delete_title", new Object[]{videoName});
86-
bodyMail = messageByLocaleService.getMessage("comment_delete_body", new Object[]{comment.user.name(), comment.commentDate, url});
86+
bodyMail = messageByLocaleService.getMessage("comment_delete_body", new Object[]{comment.user.name(), comment.commentDate, url, user.name()});
8787
log.info("send mail email = {} / title = {} / body = {}", finalEmails.toString(), title, bodyMail);
88-
services.emailService().sendCommentDeleteMessage(finalEmails.toArray(new String[finalEmails.size()]), title, comment.user.name(), comment.commentDate, url, videoName, request.getLocale());
88+
services.emailService().sendCommentDeleteMessage(finalEmails.toArray(new String[finalEmails.size()]), title, user.name(), comment.user.name(), comment.commentDate, url, videoName, request.getLocale());
8989
};
9090

9191
new Thread(task).start();
9292
} else {
93-
String values = admin.username + ';' + videoName + ';' + comment.user.name() + ';' + comment.commentDate ;
93+
String values = user.name() + ';' + videoName + ';' + comment.user.name() + ';' + comment.commentDate ;
9494
MessageServer messageServer = new MessageServer(new Date(), "CommentDeleteMessage", values, ActionType.NO);
9595
services.messageServerService().addMessageServer(messageServer);
9696
}

app/src/main/resources/messages.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,11 @@ comment_delete=Supprimer le commentaire
710710
validate_comment_delete=Commentaire Supprimé
711711
comment_from_user_delete_message=Le commentaire de {0} va être supprimé
712712
comment_delete_title=Suppression du commentaire du signe {0}
713-
comment_delete_body=Bonjour,\nLe commentaire de {0} fait le {1} pour le signe {2} a été supprimé par l''admin.\nCordialement
714-
comment_delete_body_1=Le commentaire de {0} fait le {1} pour le signe {2} a été supprimé par l''admin.
713+
comment_delete_body=Bonjour,\nLe commentaire de {0} fait le {1} pour le signe {2} a été supprimé par {3}.\nCordialement
714+
comment_delete_body_1=Le commentaire de {0} fait le {1} pour le signe {2} a été supprimé par {3}.
715715
cordially=Cordialement
716716
CommentDeleteMessage={0} a supprimé le commentaire du signe {1} fait par {2} le {3}
717-
CommentDeleteSendEmailMessage={0} a envoyé un email à {1} indiquant la suppression du commentaire du signe {2} fait par {3} le {4}
717+
CommentDeleteSendEmailMessage={0} a envoyé un email à {1} indiquant la suppression par {2} du commentaire du signe {3} fait par {4} le {5}
718718
update_sign_definition_title=Modification de la vidéo explicative du signe {0}
719719
update_sign_definition_body=La vidéo explicative du signe {0} a été modifiée par l''admin.
720720
add_sign_definition_title=Ajout de la vidéo explicative du signe {0}

app/src/main/resources/messages_fr.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -710,11 +710,11 @@ comment_delete=Supprimer le commentaire
710710
validate_comment_delete=Commentaire Supprimé
711711
comment_from_user_delete_message=Le commentaire de {0} va être supprimé
712712
comment_delete_title=Suppression du commentaire du signe {0}
713-
comment_delete_body=Bonjour,\nLe commentaire de {0} fait le {1} pour le signe {2} a été supprimé par l''admin.\nCordialement
714-
comment_delete_body_1=Le commentaire de {0} fait le {1} pour le signe {2} a été supprimé par l''admin.
713+
comment_delete_body=Bonjour,\nLe commentaire de {0} fait le {1} pour le signe {2} a été supprimé par {3}.\nCordialement
714+
comment_delete_body_1=Le commentaire de {0} fait le {1} pour le signe {2} a été supprimé par {3}.
715715
cordially=Cordialement
716716
CommentDeleteMessage={0} a supprimé le commentaire du signe {1} fait par {2} le {3}
717-
CommentDeleteSendEmailMessage={0} a envoyé un email à {1} indiquant la suppression du commentaire du signe {2} fait par {3} le {4}
717+
CommentDeleteSendEmailMessage={0} a envoyé un email à {1} indiquant la suppression par {2} du commentaire du signe {3} fait par {4} le {5}
718718
update_sign_definition_title=Modification de la vidéo explicative du signe {0}
719719
update_sign_definition_body=La vidéo explicative du signe {0} a été modifiée par l''admin.
720720
add_sign_definition_title=Ajout de la vidéo explicative du signe {0}

0 commit comments

Comments
 (0)