summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-04 21:16:44 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-04 21:16:44 +0200
commitbee2677e895eda5de109c103494791f73b56c256 (patch)
tree8004ad3e1cd8d44acd1de7fc840603d2d9a79713 /src
parent8dcc6ae4ee418cdfdc60c76709ad03b4814fb83a (diff)
KB66 Assign comment owner if logged in.
Change-Id: I63cb2c2350f5183b7fbca335df8a06425193e015
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java5
-rw-r--r--src/main/resources/templates/tags/commentBox.html4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
index d1e5775..569c535 100644
--- a/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
+++ b/src/main/java/eu/mulk/mulkcms2/benki/posts/PostResource.java
@@ -344,6 +344,11 @@ public abstract class PostResource {
assignPostTargets(post.getVisibility(), post.owner, comment);
comment.persist();
+ var currentUser = getCurrentUser();
+ if (currentUser != null) {
+ comment.owner = currentUser;
+ }
+
var admins = User.findAdmins();
var mailText = Templates.commentNotificationMail(postId, comment);
diff --git a/src/main/resources/templates/tags/commentBox.html b/src/main/resources/templates/tags/commentBox.html
index abe73f5..41907ab 100644
--- a/src/main/resources/templates/tags/commentBox.html
+++ b/src/main/resources/templates/tags/commentBox.html
@@ -24,9 +24,9 @@
{#for comment in comments}
<div class="comment" id="comment-{comment.id}">
- {#if comment.owner != null}<span class="comment-owner post-owner">{comment.owner.firstName}</span>{/if}
-
<div class="comment-info">
+ {#if comment.owner != null}<span class="comment-owner post-owner">{comment.owner.firstName}</span>{/if}
+
<a class="comment-link" href="/posts/{postId}#comment-{comment.id}">
<span class="comment-self-link">#</span>
</a>