Add some limits to tags

This commit is contained in:
Tienson Qin
2020-06-30 22:16:40 +08:00
parent 943befd708
commit b1827ec5fc
5 changed files with 49 additions and 24 deletions

View File

@@ -87,12 +87,15 @@
(defn ->tags
[tags]
(mapv (fn [tag]
(->> (map (fn [tag]
(let [tag (-> (string/lower-case tag)
(string/replace #"\s+" "-"))]
{:db/id tag
:tag/name tag}))
(remove nil? tags)))
(if (util/tag-valid? tag)
{:db/id tag
:tag/name tag})))
(remove nil? tags))
(remove nil?)
vec))
(defn with-refs
[{:keys [title body tags] :as heading}]