Преглед на файлове

Merge branch 'master' into feat/capacitor-new

Tienson Qin преди 6 месеца
родител
ревизия
16d86daab9

+ 2 - 2
README.md

@@ -68,9 +68,9 @@
 
 ## 🚀 Database Version
 
-The Database version (DB version) of Logseq introduces DB graphs while maintaining support for file graphs. [See this page](https://github.com/logseq/docs/blob/feat/db/db-version.md) to get an overview of the main features for DB graphs. If you are an existing user, [see this page](https://github.com/logseq/docs/blob/feat/db/db-version-changes.md) to get an overview of changes with the DB version.
+The Database version (DB version) of Logseq introduces DB graphs while maintaining support for file graphs. [See this page](https://github.com/logseq/docs/blob/master/db-version.md) to get an overview of the main features for DB graphs. If you are an existing user, [see this page](https://github.com/logseq/docs/blob/master/db-version-changes.md) to get an overview of changes with the DB version.
 
-The DB version of Logseq is alpha software. When using DB graphs, we recommend you create a dedicated test graph and choose one project/workflow that’s not crucial for you. **Data loss is possible**, which is why we recommend [automated backups](https://github.com/logseq/docs/blob/feat/db/db-version.md#automated-backup) or making [regular SQLite DB backups](https://github.com/logseq/docs/blob/feat/db/db-version.md#graph-export). When using file graphs, **data corruption is possible** as some file content can be duplicated. We only recommend using file graphs if you are making regular backups with git.
+The DB version of Logseq is alpha software. When using DB graphs, we recommend you create a dedicated test graph and choose one project/workflow that’s not crucial for you. **Data loss is possible**, which is why we recommend [automated backups](https://github.com/logseq/docs/blob/master/db-version.md#automated-backup) or making [regular SQLite DB backups](https://github.com/logseq/docs/blob/master/db-version.md#graph-export). When using file graphs, **data corruption is possible** as some file content can be duplicated. We only recommend using file graphs if you are making regular backups with git.
 
 To try the latest web version, go to https://test.logseq.com/. For DB version issues, please report them to https://github.com/logseq/db-test/issues.
 

+ 1 - 13
deps/db/src/logseq/db.cljs

@@ -18,7 +18,6 @@
             [logseq.db.frontend.db :as db-db]
             [logseq.db.frontend.entity-util :as entity-util]
             [logseq.db.frontend.property :as db-property]
-            [logseq.db.frontend.rules :as rules]
             [logseq.db.frontend.schema :as db-schema]
             [logseq.db.sqlite.util :as sqlite-util])
   (:refer-clojure :exclude [object?]))
@@ -422,18 +421,7 @@
       ;; only return the first result for idiot-proof
     (first (:block/_alias (d/entity db alias-id)))))
 
-(defn get-block-alias
-  [db eid]
-  (->>
-   (d/q
-    '[:find [?e ...]
-      :in $ ?eid %
-      :where
-      (alias ?eid ?e)]
-    db
-    eid
-    (:alias rules/rules))
-   distinct))
+(def get-block-alias common-initial-data/get-block-alias)
 
 (defn page-alias-set
   [db page-id]

+ 24 - 5
deps/db/src/logseq/db/common/initial_data.cljs

@@ -9,7 +9,8 @@
             [logseq.db.common.entity-plus :as entity-plus]
             [logseq.db.common.entity-util :as common-entity-util]
             [logseq.db.common.order :as db-order]
-            [logseq.db.frontend.entity-util :as entity-util]))
+            [logseq.db.frontend.entity-util :as entity-util]
+            [logseq.db.frontend.rules :as rules]))
 
 (defn- get-pages-by-name
   [db page-name]
@@ -33,6 +34,19 @@
        sort
        first))
 
+(defn get-block-alias
+  [db eid]
+  (->>
+   (d/q
+    '[:find [?e ...]
+      :in $ ?eid %
+      :where
+      (alias ?eid ?e)]
+    db
+    eid
+    (:alias rules/rules))
+   distinct))
+
 (comment
   (defn- get-built-in-files
     [db]
@@ -163,6 +177,7 @@
         (or
          (= (:db/id ref-block) id)
          (= id (:db/id (:block/page ref-block)))
+         (= id (:db/id (:logseq.property/view-for ref-block)))
          (entity-util/hidden? (:block/page ref-block))
          (entity-util/hidden? ref-block)
          (contains? (set (map :db/id (:block/tags ref-block))) (:db/id entity))
@@ -174,10 +189,14 @@
 (defn get-block-refs-count
   [db id]
   (or
-   (some->> (d/entity db id)
-            :block/_refs
-            (remove (fn [ref-block] (hidden-ref? db ref-block id)))
-            count)
+   (let [with-alias (->> (get-block-alias db id)
+                         (cons id)
+                         distinct)]
+     (some->> with-alias
+              (map #(d/entity db %))
+              (mapcat :block/_refs)
+              (remove (fn [ref-block] (hidden-ref? db ref-block id)))
+              count))
    0))
 
 (defn ^:large-vars/cleanup-todo get-block-and-children

+ 7 - 5
deps/db/src/logseq/db/common/view.cljs

@@ -317,16 +317,18 @@
         ref-blocks (cond->> full-ref-blocks
                      (seq page-filters)
                      (filter-blocks page-filters))
-        ref-pages-count (->> (mapcat (fn [block]
+        ref-pages-count (->> full-ref-blocks
+                             (mapcat (fn [block]
                                        (->>
                                         (cons
                                          (:block/title (:block/page block))
                                          (map (fn [b]
-                                                (when (and (ldb/page? b) (not= (:db/id b) id))
+                                                (when (and (ldb/page? b)
+                                                           (not= (:db/id b) id)
+                                                           (not (contains? #{:block/tags} (:db/ident b))))
                                                   (:block/title b)))
-                                              (:block/refs block)))
-                                        distinct))
-                                     full-ref-blocks)
+                                              (:block/path-refs block)))
+                                        distinct)))
                              (remove nil?)
                              (frequencies)
                              (sort-by second #(> %1 %2)))]

+ 2 - 1
deps/outliner/src/logseq/outliner/property.cljs

@@ -40,7 +40,8 @@
                             true
                             (assoc property-id value)
                             (and (contains? #{:logseq.property/status :logseq.property/scheduled :logseq.property/deadline} property-id)
-                                 (or (empty? (:block/tags block)) (ldb/internal-page? block)))
+                                 (or (empty? (:block/tags block)) (ldb/internal-page? block))
+                                 (not (get (d/pull @conn [property-id] (:db/id block)) property-id)))
                             (assoc :block/tags :logseq.class/Task))]
       (cond-> []
         multiple-values-empty?

+ 0 - 1
docs/develop-logseq.md

@@ -40,7 +40,6 @@ Open a dev environment (Browser dev app on ``localhost:3000`` or Desktop dev app
 ``cmd + shift + p`` -> ``Calva: Load/Evaluate Current File and its Requires/Dependencies``
 
 #### Connect to the web-worker context
-Notice: this works only for the `feat/db` branch for now.
 
 ##### Emacs + Cider
 When connecting to a CLJ nrepl (NOTE: if you are already in a CLJS nrepl, use `:cljs/quit` to go back to CLJ nrepl),

+ 1 - 0
resources/forge.config.js

@@ -6,6 +6,7 @@ module.exports = {
     name: 'Logseq',
     icon: './icons/logseq_big_sur.icns',
     buildVersion: "87",
+    appBundleId: "com.logseq.logseq",
     protocols: [
       {
         "protocol": "logseq",

+ 1 - 13
src/main/frontend/worker/db_worker.cljs

@@ -535,19 +535,7 @@
                              (let [refs (map :db/id (:block/refs (d/entity db (:e d))))]
                                (contains? (set refs) (:e d)))))
                       datoms)))))
-        (boolean
-         (some
-          ;; check if there's any entity reference this `block` except the view-entity
-          (fn [ref]
-            (not
-             (or (= id (:db/id (:logseq.property/view-for ref)))
-                 (ldb/hidden? (:block/page ref))
-                 (ldb/hidden? ref)
-                 (and db-based? (contains? (set (map :db/id (:block/tags ref))) id))
-                 (some? (get ref (:db/ident block)))
-                 (= id (:db/id ref))
-                 (= id (:db/id (:block/page ref))))))
-          (:block/_refs block)))))))
+        (> (ldb/get-block-refs-count db (:db/id block)) 0)))))
 
 (def-thread-api :thread-api/get-block-parents
   [repo id depth]