fix: property? should not treat classes as properties

This commit is contained in:
Gabriel Horner
2025-06-16 11:51:50 -04:00
committed by Tienson Qin
parent b48dfce552
commit 2e19702afc
3 changed files with 8 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
(ns logseq.db.frontend.class
"Class related fns for DB graphs and frontend/datascript usage"
(:require [clojure.set :as set]
[clojure.string :as string]
[datascript.core :as d]
[flatland.ordered.map :refer [ordered-map]]
[logseq.common.defkeywords :refer [defkeywords]]
@@ -153,3 +154,8 @@
"Determines if keyword is a logseq class"
[kw]
(= logseq-class (namespace kw)))
(defn user-class-namespace?
"Determines if namespace string is a user class"
[s]
(string/includes? s ".class"))

View File

@@ -622,11 +622,6 @@
[s]
(string/includes? s ".property"))
(defn user-class-namespace?
"Determines if namespace string is a user class"
[s]
(string/includes? s ".class"))
(defn internal-property?
"Determines if ident kw is an internal property. This includes db-attribute properties
unlike logseq-property? and doesn't include non-property idents unlike internal-ident?"
@@ -643,7 +638,6 @@
(and k-name
(or (contains? logseq-property-namespaces k-name)
(user-property-namespace? k-name)
(user-class-namespace? k-name)
;; disallow private db-attribute-properties as they cause unwanted refs
;; and appear noisily in debugging contexts
(and (keyword? k) (contains? public-db-attribute-properties k))))))

View File

@@ -66,7 +66,8 @@
(defn- get-ident [all-idents kw]
(if (and (qualified-keyword? kw)
;; Loosen checks to any property or class for build-existing-tx?
(db-property/property? kw))
(or (db-property/property? kw)
(db-class/user-class-namespace? (namespace kw))))
kw
(or (get all-idents kw)
(throw (ex-info (str "No ident found for " (pr-str kw)) {})))))