From b0a4cdcc17e4138a74b04fd2ad3bb3a592133e5f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 21 Nov 2016 18:56:04 +0100 Subject: [PATCH] Mark as :builtin icon collections that has :user as uuid/zero. --- frontend/src/uxbox/main/data/icons.cljs | 6 +++--- frontend/src/uxbox/util/uuid.cljs | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/uxbox/main/data/icons.cljs b/frontend/src/uxbox/main/data/icons.cljs index 6e14d44d8..1a580c026 100644 --- a/frontend/src/uxbox/main/data/icons.cljs +++ b/frontend/src/uxbox/main/data/icons.cljs @@ -60,9 +60,9 @@ (defrecord CollectionsFetched [items] rs/UpdateEvent (-apply-update [_ state] - (reduce (fn [state item] - (let [id (:id item) - item (assoc item :type :own)] + (reduce (fn [state {:keys [id user] :as item}] + (let [type (if (uuid/zero? (:user item)) :builtin :own) + item (assoc item :type type)] (assoc-in state [:icons-collections id] item))) state items))) diff --git a/frontend/src/uxbox/util/uuid.cljs b/frontend/src/uxbox/util/uuid.cljs index db225b57e..11b11a8b5 100644 --- a/frontend/src/uxbox/util/uuid.cljs +++ b/frontend/src/uxbox/util/uuid.cljs @@ -13,8 +13,15 @@ If no high qualiry RNG, switches to the default Math based RNG with proper waring in the console." + (:refer-clojure :exclude [zero?]) (:require [uxbox.util.uuid-impl :as impl])) +(def zero #uuid "00000000-0000-0000-0000-000000000000") + +(defn zero? + [v] + (= zero v)) + (defn v4 "Generate a v4 (random) UUID." []