KB66 Assign comment owner if logged in.
Change-Id: I63cb2c2350f5183b7fbca335df8a06425193e015
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 @@
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>