From 26ec3f8cd7906a0a80cd75a937e8c8028a358fa9 Mon Sep 17 00:00:00 2001 From: Eric Dvorsak Date: Sun, 28 Oct 2018 17:03:00 +0100 Subject: [PATCH] [refactor] remove unused functions in handlers Signed-off-by: yenda --- src/status_im/contact/core.cljs | 2 +- src/status_im/utils/handlers.cljs | 28 ++++++---------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/status_im/contact/core.cljs b/src/status_im/contact/core.cljs index 3fd63caa62..d6730dc5f3 100644 --- a/src/status_im/contact/core.cljs +++ b/src/status_im/contact/core.cljs @@ -26,7 +26,7 @@ ;; it's not in the contact list at all (nil? pending?)))) -(defn build-contact [{{:keys [chats]:account/keys [account] +(defn build-contact [{{:keys [chats] :account/keys [account] :contacts/keys [contacts]} :db} public-key] (cond-> (assoc (or (get contacts public-key) (utils.contacts/public-key->new-contact public-key)) diff --git a/src/status_im/utils/handlers.cljs b/src/status_im/utils/handlers.cljs index 77231b53d0..c009f5c0c3 100644 --- a/src/status_im/utils/handlers.cljs +++ b/src/status_im/utils/handlers.cljs @@ -1,7 +1,7 @@ (ns status-im.utils.handlers (:require [cljs.spec.alpha :as spec] [clojure.string :as string] - [re-frame.core :refer [reg-event-db reg-event-fx] :as re-frame] + [re-frame.core :as re-frame] [re-frame.interceptor :refer [->interceptor get-coeffect get-effect]] [status-im.accounts.db :as accounts.db] [cljs.core.async :as async] @@ -89,30 +89,14 @@ (throw (ex-info (check-spec-msg event-id new-db) {}))) context)))) -(defn register-handler - ([name handler] (register-handler name nil handler)) - ([name middleware handler] - (reg-event-db name [debug-handlers-names (when js/goog.DEBUG check-spec) middleware] handler))) - (def default-interceptors [debug-handlers-names - (when js/goog.DEBUG check-spec) + (when js/goog.DEBUG + check-spec) (re-frame/inject-cofx :now)]) (defn register-handler-fx - ([name handler] (register-handler-fx name nil handler)) + ([name handler] + (register-handler-fx name nil handler)) ([name interceptors handler] - (reg-event-fx name [default-interceptors interceptors] handler))) - -(defn get-hashtags [status] - (if status - (let [hashtags (map #(keyword (string/lower-case (subs % 1))) - (re-seq #"#[^ !?,;:.]+" status))] - (set (or hashtags []))) - #{})) - -(defn identities [contacts] - (->> (map second contacts) - (remove (fn [{:keys [dapp? pending?]}] - (or pending? dapp?))) - (map :public-key))) + (re-frame/reg-event-fx name [default-interceptors interceptors] handler)))