Add comment permalink copy button
authorLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Mar 2023 18:56:19 +0000 (14:56 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Tue, 14 Mar 2023 18:56:19 +0000 (14:56 -0400)
src/main/kotlin/info/mechyrdia/data/view_comments.kt

index 390967eb5c3b4ec6a16eddfd35b8a0c6a896b82f..42e044ecfa4fc9e8f95479eb8099d4cd61e6a0d5 100644 (file)
@@ -95,23 +95,30 @@ fun FlowContent.commentBox(comment: CommentRenderData, loggedInAs: Id<NationData
                        p {
                                style = "font-size:0.8em"
                                a(href = "/comment/view/${comment.id}") {
-                                       +"Link"
+                                       +"Permalink"
                                }
-                               
-                               +Entities.nbsp
-                               +"\u2022"
                                +Entities.nbsp
                                a(href = "#", classes = "copy-text") {
-                                       attributes["data-text"] = "[reply]${comment.id}[/reply]"
-                                       +"Reply"
+                                       attributes["data-text"] = "https://mechyrdia.info/comment/view/${comment.id}"
+                                       +"(Copy)"
                                }
                                
-                               +Entities.nbsp
-                               +"\u2022"
-                               +Entities.nbsp
-                               a(href = "#", classes = "copy-text") {
-                                       attributes["data-text"] = "[quote]${comment.contentsRaw}[/quote][reply]${comment.id}[/reply]"
-                                       +"Quote Reply"
+                               if (loggedInAs != null) {
+                                       +Entities.nbsp
+                                       +"\u2022"
+                                       +Entities.nbsp
+                                       a(href = "#", classes = "copy-text") {
+                                               attributes["data-text"] = "[reply]${comment.id}[/reply]"
+                                               +"Reply"
+                                       }
+                                       
+                                       +Entities.nbsp
+                                       +"\u2022"
+                                       +Entities.nbsp
+                                       a(href = "#", classes = "copy-text") {
+                                               attributes["data-text"] = "[quote]${comment.contentsRaw}[/quote][reply]${comment.id}[/reply]"
+                                               +"Quote Reply"
+                                       }
                                }
                                
                                if (loggedInAs == comment.submittedBy.id) {