diff --git a/src/cljs/athens/views/blocks/core.cljs b/src/cljs/athens/views/blocks/core.cljs index 293d82cb72..a8417273f8 100644 --- a/src/cljs/athens/views/blocks/core.cljs +++ b/src/cljs/athens/views/blocks/core.cljs @@ -493,7 +493,6 @@ ;; Show comments when the toggle is on (when (and @show-comments? - open (or @show-textarea? (comments/get-comment-thread-uid @db/dsdb uid))) [inline-comments/inline-comments (comments/get-comments-in-thread @db/dsdb (comments/get-comment-thread-uid @db/dsdb uid)) uid false]) diff --git a/src/cljs/athens/views/comments/core.cljs b/src/cljs/athens/views/comments/core.cljs index 49ee168a21..34a3a61e9c 100644 --- a/src/cljs/athens/views/comments/core.cljs +++ b/src/cljs/athens/views/comments/core.cljs @@ -271,7 +271,7 @@ :comment/write-comment ;; There is a sequence for how the operations are to be executed because for some ops, information ;; related to prior op is needed. The sequence is: - ;; - Create a thread if it does not exist with the author as member and subscriber to the thread. + ;; - Create a thread if it does not exist with the block and the comment author as member and subscriber to the thread. ;; - Add comment to the thread. ;; - If the comment contains mentions to users not subscribed to the thread, then add them as subscribers and members. ;; - If this is not the first comment on the thread then add the author of comment as subscriber and member to the thread. @@ -281,7 +281,10 @@ (let [thread-exists? (get-comment-thread-uid @db/dsdb uid) thread-uid (or thread-exists? (common.utils/gen-block-uid)) - + block-author (-> (common-db/get-block-document @db/dsdb [:block/uid uid]) + :block/create + :event/auth + :presence/id) {thread-members-uid :members-prop-uid thread-subs-uid :subscribers-prop-uid new-thread-op :new-thread-op} (when (not thread-exists?) @@ -296,14 +299,23 @@ add-mentions-in-str-as-mem-subs-op (add-mentioned-users-as-member-and-subscriber @db/dsdb thread-members-uid thread-subs-uid comment-string thread-uid thread-exists? author) add-author-as-mem-or-subs (when thread-exists? (add-user-as-member-or-subscriber? @db/dsdb thread-uid (str "[[@" author "]]"))) - notification-message (str "**((" uid "))**" "\n" "*[[@" author "]] commented: " comment-string "*") + [add-block-author-as-sub-and-mem + block-author-notification-op] (when (and + (not= author block-author) + (not thread-exists?)) + [(concat [] + (add-new-member-or-subscriber-to-prop-uid @db/dsdb thread-members-uid (str "[[@" block-author "]]")) + (add-new-member-or-subscriber-to-prop-uid @db/dsdb thread-subs-uid (str "[[@" block-author "]]"))) + (create-notification-op-for-users @db/dsdb uid [(str "[[@" block-author "]]")] author notification-message comment-uid "athens/notification/type/comment") ()]) notification-op (create-notification-op-for-comment @db/dsdb uid thread-uid author comment-string notification-message comment-uid) ops (concat add-author-as-mem-or-subs new-thread-op [comment-op] add-mentions-in-str-as-mem-subs-op + add-block-author-as-sub-and-mem + block-author-notification-op notification-op) comment-notif-op (composite/make-consequence-op {:op/type :comment-notif-op} diff --git a/src/cljs/athens/views/notifications/popover.cljs b/src/cljs/athens/views/notifications/popover.cljs index ea023c057a..dbe7a79c78 100644 --- a/src/cljs/athens/views/notifications/popover.cljs +++ b/src/cljs/athens/views/notifications/popover.cljs @@ -130,7 +130,7 @@ (when (.. e -shiftKey) (rf/dispatch [:right-sidebar/open-item [:node/title user-page-title]]))) :icon (r/as-element [:> BellFillIcon])}] - (when (> 0 num-notifications) + (when (> num-notifications 0) [:> Badge {:position "absolute" :bg "highlight" :color "highlightContrast"