浏览代码

fix: block type filter

Tienson Qin 1 年之前
父节点
当前提交
8e41e1d22c
共有 2 个文件被更改,包括 10 次插入3 次删除
  1. 6 2
      src/main/frontend/components/views.cljs
  2. 4 1
      src/main/frontend/worker/handler/page/db_based/page.cljs

+ 6 - 2
src/main/frontend/components/views.cljs

@@ -619,7 +619,7 @@
                 (->> (get-property-values (:data table) property)
                      (map (fn [{:keys [value label]}]
                             {:label label
-                             :value (:block/uuid value)}))))
+                             :value (or (:block/uuid value) value)}))))
         filters (get-in table [:state :filters])
         set-filters! (:set-filters! data-fns)
         many? (if (or (contains? #{:date-before :date-after :before :after} operator)
@@ -766,8 +766,12 @@
               :is
               (if (boolean? match)
                 (= (boolean (get-property-value-content (get row property-ident))) match)
-                (if (and (empty? match) (empty? value'))
+                (cond
+                  (empty? match)
+                  true
+                  (and (empty? match) (empty? value'))
                   true
+                  :else
                   (if entity?
                     (boolean (seq (set/intersection (set (map :block/uuid value')) match)))
                     (boolean (seq (set/intersection (set value') match))))))

+ 4 - 1
src/main/frontend/worker/handler/page/db_based/page.cljs

@@ -15,7 +15,10 @@
 
 (defn- build-page-tx [conn properties page {:keys [whiteboard? class? tags]}]
   (when (:block/uuid page)
-    (let [page (assoc page :block/type (cond class? "class" whiteboard? "whiteboard" :else "page"))
+    (let [page (assoc page :block/type (cond class? "class"
+                                             whiteboard? "whiteboard"
+                                             (:block/type page) (:block/type page)
+                                             :else "page"))
           page' (merge page
                        (when tags {:block/tags (mapv #(hash-map :db/id
                                                                 (:db/id (d/entity @conn [:block/uuid %])))