Ver Fonte

feat: revert to public instead of publishable

Junyu Zhan há 4 anos atrás
pai
commit
84f3e698df

+ 3 - 3
src/main/frontend/components/page.cljs

@@ -283,7 +283,7 @@
                       (= page-name (string/lower-case (date/journal-name))))
               developer-mode? (state/sub [:ui/developer-mode?])
               published? (= "true" (:published properties))
-              publishable? (= "true" (:publishable properties))]
+              public? (= "true" (:public properties))]
           [:div.flex-1.page.relative (if (seq (:page/tags page))
                                        (let [page-names (model/get-page-names-by-ids (map :db/id (:page/tags page)))]
                                          {:data-page-tags (text/build-data-value page-names)})
@@ -313,12 +313,12 @@
                               {:title (t :page/delete)
                                :options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
 
-                            {:title  (t (if publishable? :page/make-private :page/make-public))
+                            {:title  (t (if public? :page/make-private :page/make-public))
                              :options {:on-click
                                        (fn []
                                          (page-handler/update-public-attribute!
                                           page-name
-                                          (if publishable? false true))
+                                          (if public? false true))
                                          (state/close-modal!))}}
 
                             (when file

+ 26 - 26
src/main/frontend/db/model.cljs

@@ -44,7 +44,7 @@
     ;;            [(identity ?vs) [?v ...]]
     ;;            (not-join [?e ?v]
     ;;                      [?e ?a ?v]))]
-    ])
+])
 
 (defn transact-files-db!
   ([tx-data]
@@ -156,7 +156,7 @@
             :where
             [?file :file/path ?path]
             ;; [?file :file/last-modified-at ?modified-at]
-            ]
+]
           conn)
          (seq)
          ;; (sort-by last)
@@ -845,17 +845,17 @@
   (when-let [conn (conn/get-conn repo)]
     (->
      (d/q
-      '[:find [?ref-page ...]
-        :in $ % ?page
-        :where
-        [?p :page/name ?page]
-        [?b :block/path-ref-pages ?p]
-        [?b :block/ref-pages ?other-p]
-        [(not= ?p ?other-p)]
-        [?other-p :page/name ?ref-page]]
-      conn
-      rules
-      page)
+       '[:find [?ref-page ...]
+         :in $ % ?page
+         :where
+         [?p :page/name ?page]
+         [?b :block/path-ref-pages ?p]
+         [?b :block/ref-pages ?other-p]
+         [(not= ?p ?other-p)]
+         [?other-p :page/name ?ref-page]]
+       conn
+       rules
+       page)
      (distinct))))
 
 ;; Ignore files with empty blocks for now
@@ -934,15 +934,15 @@
     (when (seq blocks)
       (let [block-ids (set (map :db/id blocks))
             refs (d/q
-                  '[:find ?p ?ref
-                    :in $ % ?block-ids
-                    :where
-                    (parent ?p ?b)
-                    [(contains? ?block-ids ?p)]
-                    [?b :block/ref-pages ?ref]]
-                  conn
-                  rules
-                  block-ids)
+                   '[:find ?p ?ref
+                     :in $ % ?block-ids
+                     :where
+                     (parent ?p ?b)
+                     [(contains? ?block-ids ?p)]
+                     [?b :block/ref-pages ?ref]]
+                   conn
+                   rules
+                   block-ids)
             refs (->> (group-by first refs)
                       (medley/map-vals #(set (map (fn [[_ id]] {:db/id id}) %))))]
         (map (fn [block] (assoc block :block/children-refs
@@ -1147,7 +1147,7 @@
        '[:find ?p
          :where
          [?p :page/properties ?d]
-         [(get ?d :publishable) ?pub]
+         [(get ?d :public) ?pub]
          [(= "true" ?pub)]]
        db)
       (db-utils/seq-flatten)))
@@ -1178,8 +1178,8 @@
      @blocks-count-cache
      (when-let [conn (conn/get-conn)]
        (let [n (count (d/datoms conn :avet :block/uuid))]
-         (reset! blocks-count-cache n)
-         n)))))
+        (reset! blocks-count-cache n)
+        n)))))
 
 ;; block/uuid and block/content
 (defn get-all-block-contents
@@ -1310,4 +1310,4 @@
                    [(contains? ?refs ?b-ref)]))]
        (conn/get-conn)
        rules
-       page-ids))
+    page-ids))

+ 5 - 5
src/main/frontend/dicts.cljs

@@ -229,8 +229,8 @@ title: How to take dummy notes?
         :page/open-in-finder "Open in directory"
         :page/open-with-default-app "Open with default app"
         :page/action-publish "Publish"
-        :page/make-public "Set publishable"
-        :page/make-private "Set non-publishable"
+        :page/make-public "Publish it when exporting to an html file"
+        :page/make-private "Make it private"
         :page/delete "Delete page"
         :page/publish "Publish this page on Logseq"
         :page/cancel-publishing "Cancel publishing on Logseq"
@@ -320,7 +320,7 @@ title: How to take dummy notes?
         :graph "Graph"
         :graph-view "View Graph"
         :publishing "Publishing"
-        :export "Export publishable pages"
+        :export "Export public pages"
         :all-graphs "All graphs"
         :all-pages "All pages"
         :all-files "All files"
@@ -956,8 +956,8 @@ title: How to take dummy notes?
            :page/open-in-finder "打开文件对应目录"
            :page/open-with-default-app "用默认应用打开文件"
            :page/action-publish "发布"
-           :page/make-public "发布时包括"
-           :page/make-private "发布时排除"
+           :page/make-public "导出 HTML 时发布本页面"
+           :page/make-private "导出 HTML 时取消发布本页面"
            :page/delete "删除本页"
            :page/publish "将本页发布至 Logseq"
            :page/cancel-publishing "撤回本页在 Logseq 上的发布"

+ 1 - 1
src/main/frontend/handler/export.cljs

@@ -59,7 +59,7 @@
 (defn export-repo-as-html!
   [repo]
   (when-let [db (db/get-conn repo)]
-    (let [db           (if (state/all-pages-publishable?)
+    (let [db           (if (state/all-pages-public?)
                          (db/clean-export! db)
                          (db/filter-only-public-pages-and-blocks db))
           db-str       (db/db->string db)

+ 3 - 3
src/main/frontend/handler/page.cljs

@@ -432,7 +432,7 @@
 
 (defn update-public-attribute!
   [page-name value]
-  (page-add-properties! page-name {:publishable value}))
+  (page-add-properties! page-name {:public value}))
 
 (defn get-page-ref-text
   [page]
@@ -516,8 +516,8 @@
 (defn ls-dir-files!
   []
   (web-nfs/ls-dir-files-with-handler!
-   (fn []
-     (init-commands!))))
+    (fn []
+      (init-commands!))))
 
 
 ;; TODO: add use :file/last-modified-at

+ 3 - 3
src/main/frontend/state.cljs

@@ -179,9 +179,9 @@
   []
   (:custom-css-url (get-config)))
 
-(defn all-pages-publishable?
+(defn all-pages-public?
   []
-  (true? (:all-pages-publishable? (get-config))))
+  (true? (:all-pages-public? (get-config))))
 
 (defn enable-grammarly?
   []
@@ -376,7 +376,7 @@
      ;;                        (remove #(= leader-parent %)))]
      ;;     (prn "followers: " (count followers))
      ;;     ))
-     )))
+)))
 
 (defn get-edit-input-id
   []