Browse Source

fix: favorite page prefer id instead of name

Tienson Qin 1 year ago
parent
commit
0876198cca

+ 1 - 1
.github/workflows/deploy-db-test-pages.yml

@@ -41,7 +41,7 @@ jobs:
 
       - name: Build Released-Web
         run: |
-          yarn gulp:build && clojure -M:cljs release app  --config-merge '{:compiler-options {:source-map-include-sources-content false :source-map-detail-level :symbols}}'
+          yarn gulp:build && clojure -M:cljs release app  --config-merge '{:compiler-options {:source-map true :source-map-include-sources-content false :source-map-detail-level :symbols}}'
           rsync -avz --exclude node_modules --exclude android --exclude ios ./static/ ./public/static/
           ls -lR ./public
 

+ 2 - 1
src/main/frontend/components/container.cljs

@@ -74,6 +74,7 @@
 (rum/defc page-name
   [page icon recent?]
   (let [repo (state/get-current-repo)
+        db-based? (config/db-based-graph? repo)
         page (or (db/get-alias-source-page repo (:db/id page)) page)
         title (:block/title page)
         whiteboard-page? (db-model/whiteboard-page? page)
@@ -91,7 +92,7 @@
                            [:<>
                             (when-not recent?
                               (x-menu-item
-                               {:on-click #(page-handler/<unfavorite-page! title)}
+                               {:on-click #(page-handler/<unfavorite-page! (if db-based? (str (:block/uuid page)) title))}
                                (ctx-icon "star-off")
                                (t :page/unfavorite)
                                (x-menu-shortcut (when-let [binding (shortcut-dh/shortcut-binding :command/toggle-favorite)]

+ 4 - 4
src/main/frontend/components/page_menu.cljs

@@ -49,13 +49,14 @@
   [page]
   (when-let [page-name (and page (db/page? page) (:block/name page))]
     (let [repo (state/sub :git/current-repo)
-          page-title (:block/title page)
+          db-based? (config/db-based-graph? repo)
+          page-title (if db-based? (str (:block/uuid page)) (:block/title page))
           whiteboard? (ldb/whiteboard? page)
           block? (and page (util/uuid-string? page-name) (not whiteboard?))
           contents? (= page-name "contents")
           public? (pu/get-block-property-value page :logseq.property/public)
           _favorites-updated? (state/sub :favorites/updated?)
-          favorited? (page-handler/favorited? page-name)
+          favorited? (page-handler/favorited? page-title)
           developer-mode? (state/sub [:ui/developer-mode?])
           file-rpath (when (util/electron?) (page-util/get-page-file-rpath page-name))
           _ (state/sub :auth/id-token)
@@ -63,8 +64,7 @@
                                     (file-sync-handler/enable-sync?)
                                     ;; FIXME: Sync state is not cleared when switching to a new graph
                                     (file-sync-handler/current-graph-sync-on?)
-                                    (file-sync-handler/get-current-graph-uuid))
-          db-based? (config/db-based-graph? repo)]
+                                    (file-sync-handler/get-current-graph-uuid))]
       (when (not block?)
         (->>
          [(when-not config/publishing?

+ 1 - 1
src/main/frontend/handler/common/page.cljs

@@ -47,7 +47,7 @@
                        (filter string?)
                        (map string/lower-case)
                        (set))]
-    (contains? favorites page-name)))
+    (contains? favorites (string/lower-case page-name))))
 
 (defn file-favorite-page!
   [page-name]