mirror of https://github.com/logseq/logseq
fix: task status switch
parent
4b34ba98e9
commit
44b167ac14
|
@ -3636,10 +3636,7 @@
|
||||||
(defn hidden-page->source-page
|
(defn hidden-page->source-page
|
||||||
[page]
|
[page]
|
||||||
(or
|
(or
|
||||||
(when-let [page-uuid (get-in (db/entity (:db/id page))
|
(:logseq.property/source-page-id page)
|
||||||
[:block/properties (:block/uuid (db/entity :logseq.property/source-page-id))])]
|
|
||||||
(db/entity [:block/uuid page-uuid]))
|
|
||||||
|
|
||||||
;; FIXME: what if the source page has been deleted?
|
;; FIXME: what if the source page has been deleted?
|
||||||
page))
|
page))
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
has-viewable-properties? (db-property-handler/block-has-viewable-properties? page)
|
has-viewable-properties? (db-property-handler/block-has-viewable-properties? page)
|
||||||
has-class-properties? (seq (:class/schema.properties page))
|
has-class-properties? (seq (:class/schema.properties page))
|
||||||
has-tags? (seq (:block/tags 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?
|
(when (or configure?
|
||||||
(and
|
(and
|
||||||
(not hide-properties?)
|
(not hide-properties?)
|
||||||
|
|
|
@ -643,8 +643,7 @@
|
||||||
(defn db-based-cycle-todo!
|
(defn db-based-cycle-todo!
|
||||||
[block]
|
[block]
|
||||||
(let [task (db/entity :logseq.class/task)
|
(let [task (db/entity :logseq.class/task)
|
||||||
status-id (:block/uuid (db/entity :logseq.property/status))
|
status-value-id (:logseq.property/status block)
|
||||||
status-value-id (get-in block [:block/properties status-id])
|
|
||||||
status-value (when status-value-id (db/entity [:block/uuid status-value-id]))
|
status-value (when status-value-id (db/entity [:block/uuid status-value-id]))
|
||||||
next-status (case (:db/ident status-value)
|
next-status (case (:db/ident status-value)
|
||||||
:logseq.property/status.todo
|
:logseq.property/status.todo
|
||||||
|
@ -653,14 +652,14 @@
|
||||||
:logseq.property/status.done
|
:logseq.property/status.done
|
||||||
:logseq.property/status.done
|
:logseq.property/status.done
|
||||||
nil
|
nil
|
||||||
:logseq.property/status.todo)
|
:logseq.property/status.todo)]
|
||||||
next-status-id (when next-status (:block/uuid (db/entity next-status)))
|
(if next-status
|
||||||
properties (if next-status-id
|
(outliner-op/save-block! {:db/id (:db/id block)
|
||||||
(assoc (:block/properties block) status-id next-status-id)
|
:logseq.property/status (:block/uuid (db/entity next-status))
|
||||||
(or (dissoc (:block/properties block) status-id) {}))]
|
:block/tags #{{:db/id (:db/id task)}}})
|
||||||
(outliner-op/save-block! {:db/id (:db/id block)
|
(db/transact! (state/get-current-repo)
|
||||||
:block/properties properties
|
[[:db/retract (:db/id block) :logseq.property/status]]
|
||||||
:block/tags #{{:db/id (:db/id task)}}})))
|
{:outliner-op :save-block}))))
|
||||||
|
|
||||||
(defn cycle-todos!
|
(defn cycle-todos!
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -430,7 +430,5 @@
|
||||||
|
|
||||||
(defn toggle-properties!
|
(defn toggle-properties!
|
||||||
[page-entity]
|
[page-entity]
|
||||||
(let [properties (:block/properties page-entity)
|
(db/transact! [[:db/add (:db/id page-entity) :logseq.property/hide-properties?
|
||||||
pid (:block/uuid (db/entity :logseq.property/hide-properties?))]
|
(not (:logseq.property/hide-properties? page-entity))]]))
|
||||||
(db/transact! [{:db/id (:db/id page-entity)
|
|
||||||
:block/properties (update properties pid not)}])))
|
|
||||||
|
|
Loading…
Reference in New Issue