Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
fix: report system
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskp committed Jun 12, 2024
1 parent fa19127 commit 181b6e6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ public class ReportPostProposal {
private Long userId;

private String type;

private Long commentId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ public HomepagePostPreviewProposal create(CreatePostProposal proposal) {
@Override
public void report(ReportPostProposal proposal) {
Map<String, Object> 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());
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/templates/report-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
<h4>Details zum Vorfall:</h4>
<ul>
<li><strong>URL zum Post:</strong> <td th:text="${post_url}"></td></li>
<li><strong>Typ:</strong> <td th:text="${content_type}"></td></li>
<li th:if="${comment_id != null}"><strong>Kommentar-ID:</strong> <td th:text="${comment_id}"></td></li>
<li><strong>Benutzer-ID des Reporters:</strong> <td th:text="${user_id_of_reporter}"></td></li>
<li><strong>Benutzer-ID des Autors:</strong> <td th:text="${user_id_of_author}"></td></li>
<li><strong>Report Grund:</strong> <td th:text="${report_reason}"></td></li>
Expand Down

0 comments on commit 181b6e6

Please sign in to comment.