mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 03:49:22 -05:00
💄 Replace db/query with db/get
This commit is contained in:
parent
5c63a5c58e
commit
27c2db6cde
1 changed files with 15 additions and 9 deletions
|
@ -72,15 +72,21 @@
|
||||||
(map decode-user-row)
|
(map decode-user-row)
|
||||||
(d/index-by :id)))
|
(d/index-by :id)))
|
||||||
|
|
||||||
|
(defn- resolve-profile-name
|
||||||
|
[conn profile-id]
|
||||||
|
(-> (db/get conn :profile {:id profile-id}
|
||||||
|
{::sql/columns [:fullname]})
|
||||||
|
(get :fullname)))
|
||||||
|
|
||||||
(defn send-comment-emails!
|
(defn send-comment-emails!
|
||||||
[conn {:keys [profile-id team-id] :as params} comment thread]
|
[conn {:keys [profile-id team-id] :as params} comment thread]
|
||||||
|
|
||||||
(let [team-users (get-team-users conn team-id)
|
(let [team-users (get-team-users conn team-id)
|
||||||
source-user (->> (db/query conn :profile {:id profile-id} {:columns [:fullname]}) first :fullname)
|
source-user (resolve-profile-name conn profile-id)
|
||||||
|
|
||||||
comment-reference (format-comment-ref thread params)
|
comment-reference (format-comment-ref thread params)
|
||||||
comment-content (format-comment comment)
|
comment-content (format-comment comment)
|
||||||
comment-url (format-comment-url params)
|
comment-url (format-comment-url params)
|
||||||
|
|
||||||
;; Users mentioned in this comment
|
;; Users mentioned in this comment
|
||||||
comment-mentions
|
comment-mentions
|
||||||
|
@ -341,11 +347,11 @@
|
||||||
|
|
||||||
(defn- get-unread-comment-threads
|
(defn- get-unread-comment-threads
|
||||||
[conn profile-id team-id]
|
[conn profile-id team-id]
|
||||||
(let [profile
|
(let [profile (-> (db/get conn :profile {:id profile-id})
|
||||||
(->> (db/query conn :profile {:id profile-id})
|
(decode-user-row))
|
||||||
(first)
|
notify (or (-> profile :props :notifications :dashboard-comments) :all)]
|
||||||
(decode-user-row))]
|
|
||||||
(case (or (-> profile :props :notifications :dashboard-comments) :all)
|
(case notify
|
||||||
:all
|
:all
|
||||||
(->> (db/exec! conn [sql:unread-all-comment-threads-by-team profile-id team-id])
|
(->> (db/exec! conn [sql:unread-all-comment-threads-by-team profile-id team-id])
|
||||||
(into [] xf-decode-row))
|
(into [] xf-decode-row))
|
||||||
|
|
Loading…
Add table
Reference in a new issue