feat: add block timestamps

Why adding block timestamps?

Block is the atomic unit for logseq instead of a page, with the
timestamps we can do a lot of things, for example:
1. show a blocks timeline related to a topic/project/habit.
2. get latest modified blocks from the page or the whole graph.
3. query dsl can have a (sort-by :last_modified_at) clause

It'll add both created_at and last_modified_at properties to
each block, not all users need this, so, it's an experiment feature,
we'll disable it by default.

Also, this PR simplify the block properties a lot, it might fix some
old issues related to properties.
This commit is contained in:
Tienson Qin
2020-12-24 22:01:35 +08:00
parent 536ce5dd87
commit 2d925d7fac
10 changed files with 210 additions and 190 deletions

View File

@@ -7,7 +7,8 @@
[frontend.storage :as storage]
[promesa.core :as p]
[goog.object :as gobj]
[frontend.handler.notification :as notification])
[frontend.handler.notification :as notification]
[frontend.handler.config :as config-handler])
(:import [goog.format EmailAddress]))
(defn email? [v]
@@ -40,13 +41,15 @@
(defn set-preferred-format!
[format]
(when format
(config-handler/set-config! :preferred_format format)
(state/set-preferred-format! format)
(when (:name (:me @state/state))
(util/post (str config/api "set_preferred_format")
{:preferred_format (name format)}
(fn [_result]
(notification/show! "Format set successfully!" :success))
(fn [_e])))))
(when (state/logged?)
(util/post (str config/api "set_preferred_format")
{:preferred_format (name format)}
(fn [_result]
(notification/show! "Format set successfully!" :success))
(fn [_e]))))))
(defn set-preferred-workflow!
[workflow]
@@ -63,9 +66,9 @@
[_e]
(when (js/confirm "Your local notes will be completely removed after signing out. Continue?")
(->
(idb/clear-local-storage-and-idb!)
(p/catch (fn [e]
(idb/clear-local-storage-and-idb!)
(p/catch (fn [e]
(println "sign out error: ")
(js/console.dir e)))
(p/finally (fn []
(p/finally (fn []
(set! (.-href js/window.location) "/logout"))))))