From 346a525a3ee08d40970ff389174a4beabeafcd52 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Fri, 14 Sep 2018 19:01:57 +0200 Subject: [PATCH] add common ns --- src/wanijo/framework/common.clj | 4 ++++ src/wanijo/schema/middleware.clj | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 src/wanijo/framework/common.clj diff --git a/src/wanijo/framework/common.clj b/src/wanijo/framework/common.clj new file mode 100644 index 0000000..303689e --- /dev/null +++ b/src/wanijo/framework/common.clj @@ -0,0 +1,4 @@ +(ns wanijo.framework.common) + +(defn in? [coll x] + (some (partial = x) coll)) diff --git a/src/wanijo/schema/middleware.clj b/src/wanijo/schema/middleware.clj index 8c5493f..2a6a2ed 100644 --- a/src/wanijo/schema/middleware.clj +++ b/src/wanijo/schema/middleware.clj @@ -1,5 +1,6 @@ (ns wanijo.schema.middleware - (:require [wanijo.schema.domain :as domain])) + (:require [wanijo.schema.domain :as domain] + [wanijo.framework.common :refer [in?]])) (defn wrap-user-schemas [handler] (fn [req] @@ -7,8 +8,7 @@ (let [created (domain/all-created-by! uuid) created-uids (map :uuid created) others (filter (fn [other] - (not (some (partial = (:uuid other)) - created-uids))) + (not (in? created-uids (:uuid other)))) (domain/all!))] (handler (-> req (assoc-in [:session :created-schemas] created)