Skip to content

Commit

Permalink
Merge pull request #2399 from sid597/rename-comment-properties
Browse files Browse the repository at this point in the history
rename comment and comment-thread properties
  • Loading branch information
sid597 authored Oct 3, 2022
2 parents 91a9ab1 + 475bc66 commit 3e3f76f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/cljs/athens/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,8 @@
[uid embed-id] (db/uid-and-embed-id uid)
block (db/get-block [:block/uid uid])
block-properties (common-db/get-block-property-document @db/dsdb [:block/uid uid])
has-comments? (not-empty (get block-properties ":comment/threads"))
has-comments? (or (not-empty (get block-properties "athens/comment-threads"))
(not-empty (get block-properties ":comment/threads")))
block-has-comments-but-no-children? (and has-comments?
(empty? (:block/children block)))
{parent-uid :block/uid
Expand Down
12 changes: 9 additions & 3 deletions src/cljs/athens/views/comments/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
:string string
:author (-> create :event/auth :presence/id)
:time (-> create :event/time :time/ts)
:edited? (boolean (get properties "athens/comment/edited"))}))
:edited? (boolean (get properties "athens/comment/is-edited"))}))


(defn add-is-follow-up?
Expand Down Expand Up @@ -84,13 +84,19 @@
add-is-follow-up?))


(defn get-comment-threads-from-props
[props]
(or (get props ":comment/threads")
(get props "athens/comment-threads")))


(defn get-comment-thread-uid
[_db parent-block-uid]
(-> (common-db/get-block-property-document @db/dsdb [:block/uid parent-block-uid])
;; TODO Multiple threads
;; I think for multiple we would have a top level property for all threads
;; Individual threads are child of the property
(get ":comment/threads")
(get-comment-threads-from-props)
:block/uid))


Expand Down Expand Up @@ -290,7 +296,7 @@
[]
[new-thread-op
(graph-ops/build-block-move-op @db/dsdb thread-uid {:block/uid uid
:relation {:page/title ":comment/threads"}})])
:relation {:page/title "athens/comment-threads"}})])
{comment-uid :comment-uid
comment-op :comment-op} (new-comment @db/dsdb thread-uid comment-string)
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)
Expand Down
4 changes: 2 additions & 2 deletions src/cljs/athens/views/comments/inline.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
(log/debug ":comment/update-comment:" uid string)
{:fx [[:dispatch-n [[:resolve-transact-forward (-> (graph-ops/build-block-save-op @db/dsdb uid string)
(common-events/build-atomic-event))]
[:graph/update-in [:block/uid uid] ["athens/comment/edited"] (fn [db prop-uid]
[(graph-ops/build-block-save-op db prop-uid "")])]
[:graph/update-in [:block/uid uid] ["athens/comment/is-edited"] (fn [db prop-uid]
[(graph-ops/build-block-save-op db prop-uid "")])]
[:editing/uid nil]]]]}))


Expand Down

0 comments on commit 3e3f76f

Please sign in to comment.