fix: task status switch

pull/11196/head
Tienson Qin 2024-03-29 14:31:24 +08:00
parent 4b34ba98e9
commit 44b167ac14
4 changed files with 13 additions and 19 deletions

View File

@ -3636,10 +3636,7 @@
(defn hidden-page->source-page
[page]
(or
(when-let [page-uuid (get-in (db/entity (:db/id page))
[:block/properties (:block/uuid (db/entity :logseq.property/source-page-id))])]
(db/entity [:block/uuid page-uuid]))
(:logseq.property/source-page-id page)
;; FIXME: what if the source page has been deleted?
page))

View File

@ -25,7 +25,7 @@
has-viewable-properties? (db-property-handler/block-has-viewable-properties? page)
has-class-properties? (seq (:class/schema.properties page))
has-tags? (seq (:block/tags page))
hide-properties? (get-in page [:block/properties (:block/uuid (db/entity :logseq.property/hide-properties?))])]
hide-properties? (:logseq.property/hide-properties? page)]
(when (or configure?
(and
(not hide-properties?)

View File

@ -643,8 +643,7 @@
(defn db-based-cycle-todo!
[block]
(let [task (db/entity :logseq.class/task)
status-id (:block/uuid (db/entity :logseq.property/status))
status-value-id (get-in block [:block/properties status-id])
status-value-id (:logseq.property/status block)
status-value (when status-value-id (db/entity [:block/uuid status-value-id]))
next-status (case (:db/ident status-value)
:logseq.property/status.todo
@ -653,14 +652,14 @@
:logseq.property/status.done
:logseq.property/status.done
nil
:logseq.property/status.todo)
next-status-id (when next-status (:block/uuid (db/entity next-status)))
properties (if next-status-id
(assoc (:block/properties block) status-id next-status-id)
(or (dissoc (:block/properties block) status-id) {}))]
(outliner-op/save-block! {:db/id (:db/id block)
:block/properties properties
:block/tags #{{:db/id (:db/id task)}}})))
:logseq.property/status.todo)]
(if next-status
(outliner-op/save-block! {:db/id (:db/id block)
:logseq.property/status (:block/uuid (db/entity next-status))
:block/tags #{{:db/id (:db/id task)}}})
(db/transact! (state/get-current-repo)
[[:db/retract (:db/id block) :logseq.property/status]]
{:outliner-op :save-block}))))
(defn cycle-todos!
[]

View File

@ -430,7 +430,5 @@
(defn toggle-properties!
[page-entity]
(let [properties (:block/properties page-entity)
pid (:block/uuid (db/entity :logseq.property/hide-properties?))]
(db/transact! [{:db/id (:db/id page-entity)
:block/properties (update properties pid not)}])))
(db/transact! [[:db/add (:db/id page-entity) :logseq.property/hide-properties?
(not (:logseq.property/hide-properties? page-entity))]]))