From 181b6e6af493c5fe0f01fd2405e88c46262b4683 Mon Sep 17 00:00:00 2001 From: denniskp <122602355+denniskp@users.noreply.github.com> Date: Wed, 12 Jun 2024 17:49:09 +0200 Subject: [PATCH] fix: report system --- .../proposal/simplified_models/ReportPostProposal.java | 2 ++ .../java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java | 4 +++- src/main/resources/templates/report-template.html | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/tinf22b6/dhbwhub/proposal/simplified_models/ReportPostProposal.java b/src/main/java/de/tinf22b6/dhbwhub/proposal/simplified_models/ReportPostProposal.java index 6abd5409..dc6a2de4 100644 --- a/src/main/java/de/tinf22b6/dhbwhub/proposal/simplified_models/ReportPostProposal.java +++ b/src/main/java/de/tinf22b6/dhbwhub/proposal/simplified_models/ReportPostProposal.java @@ -21,4 +21,6 @@ public class ReportPostProposal { private Long userId; private String type; + + private Long commentId; } diff --git a/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java b/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java index 1ea18841..23aacb89 100644 --- a/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java +++ b/src/main/java/de/tinf22b6/dhbwhub/service/PostServiceImpl.java @@ -91,7 +91,9 @@ public HomepagePostPreviewProposal create(CreatePostProposal proposal) { @Override public void report(ReportPostProposal proposal) { Map templateModel = new HashMap<>(); - templateModel.put("post_url", String.format("https://www.dhbwhub.de/post/?id=%d", proposal.getPostId())); + templateModel.put("post_url", String.format("https://www.dhbwhub.de/%s/?id=%d", proposal.getType().equals("eventComment") ? "event" : "post", proposal.getPostId())); + templateModel.put("content_type", proposal.getType()); + templateModel.put("comment_id", proposal.getCommentId()); templateModel.put("user_id_of_reporter", proposal.getUserId()); templateModel.put("user_id_of_author", proposal.getAuthorId()); templateModel.put("report_reason", proposal.getReportReason()); diff --git a/src/main/resources/templates/report-template.html b/src/main/resources/templates/report-template.html index e9d90902..0465e0df 100644 --- a/src/main/resources/templates/report-template.html +++ b/src/main/resources/templates/report-template.html @@ -48,6 +48,8 @@

Details zum Vorfall: