Fix emoji check

Signed-off-by: Dmitry Novotochinov <trybeee@gmail.com>
This commit is contained in:
janherich 2018-04-18 12:16:29 +02:00 committed by Dmitry Novotochinov
parent d0c471eef2
commit 1a9aada018
No known key found for this signature in database
GPG Key ID: 267674DCC86628D9
1 changed files with 6 additions and 6 deletions

View File

@ -25,15 +25,15 @@
contacts)] contacts)]
(:ref (get available-commands-responses response-name)))) (:ref (get available-commands-responses response-name))))
(defn- emoji-only-string? (defn- emoji-only-content?
[text] [content]
(re-matches constants/regx-emoji text)) (and (string? content) (re-matches constants/regx-emoji content)))
(defn- prepare-message (defn- prepare-message
[message chat-id current-chat?] [{:keys [content] :as message} chat-id current-chat?]
(cond-> (assoc message :appearing? true) (cond-> (assoc message :appearing? true)
(not current-chat?) (assoc :appearing? false) (not current-chat?) (assoc :appearing? false)
(emoji-only-string? (:content message)) (assoc :content-type constants/content-type-emoji))) (emoji-only-content? content) (assoc :content-type constants/content-type-emoji)))
(defn- add-message (defn- add-message
[chat-id {:keys [message-id clock-value content] :as message} current-chat? {:keys [db]}] [chat-id {:keys [message-id clock-value content] :as message} current-chat? {:keys [db]}]