mirror of
https://github.com/penpot/penpot.git
synced 2025-01-27 00:49:28 -05:00
🐛 Fix problem in firefox comments
This commit is contained in:
parent
73b53f46eb
commit
d7c00d8b45
2 changed files with 20 additions and 23 deletions
|
@ -22,6 +22,7 @@
|
||||||
[app.loggers.webhooks :as-alias webhooks]
|
[app.loggers.webhooks :as-alias webhooks]
|
||||||
[app.rpc :as-alias rpc]
|
[app.rpc :as-alias rpc]
|
||||||
[app.rpc.commands.files :as files]
|
[app.rpc.commands.files :as files]
|
||||||
|
[app.rpc.commands.profile :as profile]
|
||||||
[app.rpc.commands.teams :as teams]
|
[app.rpc.commands.teams :as teams]
|
||||||
[app.rpc.doc :as-alias doc]
|
[app.rpc.doc :as-alias doc]
|
||||||
[app.rpc.quotes :as quotes]
|
[app.rpc.quotes :as quotes]
|
||||||
|
@ -58,24 +59,10 @@
|
||||||
[{:keys [seqn]} {:keys [file-name page-name]}]
|
[{:keys [seqn]} {:keys [file-name page-name]}]
|
||||||
(str/ffmt "#%, %, %" seqn file-name page-name))
|
(str/ffmt "#%, %, %" seqn file-name page-name))
|
||||||
|
|
||||||
(defn decode-user-row
|
|
||||||
[user]
|
|
||||||
(-> user
|
|
||||||
(d/update-when :props db/decode-transit-pgobject)
|
|
||||||
(update
|
|
||||||
:mention-email?
|
|
||||||
(fn [{:keys [props]}]
|
|
||||||
(not= :none (-> props :notifications :email-comments))))
|
|
||||||
|
|
||||||
(update
|
|
||||||
:notification-email?
|
|
||||||
(fn [{:keys [props]}]
|
|
||||||
(= :all (-> props :notifications :email-comments))))))
|
|
||||||
|
|
||||||
(defn get-team-users
|
(defn get-team-users
|
||||||
[conn team-id]
|
[conn team-id]
|
||||||
(->> (teams/get-users+props conn team-id)
|
(->> (teams/get-users+props conn team-id)
|
||||||
(map decode-user-row)
|
(map profile/decode-row)
|
||||||
(d/index-by :id)))
|
(d/index-by :id)))
|
||||||
|
|
||||||
(defn- resolve-profile-name
|
(defn- resolve-profile-name
|
||||||
|
@ -84,6 +71,16 @@
|
||||||
{::sql/columns [:fullname]})
|
{::sql/columns [:fullname]})
|
||||||
(get :fullname)))
|
(get :fullname)))
|
||||||
|
|
||||||
|
(defn- notification-email?
|
||||||
|
[profile-id owner-id props]
|
||||||
|
(if (= profile-id owner-id)
|
||||||
|
(not= :none (-> props :notifications :email-comments))
|
||||||
|
(= :all (-> props :notifications :email-comments))))
|
||||||
|
|
||||||
|
(defn- mention-email?
|
||||||
|
[props]
|
||||||
|
(not= :none (-> props :notifications :email-comments)))
|
||||||
|
|
||||||
(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]
|
||||||
|
|
||||||
|
@ -115,8 +112,8 @@
|
||||||
(disj profile-id))]
|
(disj profile-id))]
|
||||||
|
|
||||||
(doseq [mention comment-mentions]
|
(doseq [mention comment-mentions]
|
||||||
(let [{:keys [fullname email mention-email?]} (get team-users mention)]
|
(let [{:keys [fullname email props]} (get team-users mention)]
|
||||||
(when mention-email?
|
(when (mention-email? props)
|
||||||
(eml/send!
|
(eml/send!
|
||||||
{::eml/conn conn
|
{::eml/conn conn
|
||||||
::eml/factory eml/comment-mention
|
::eml/factory eml/comment-mention
|
||||||
|
@ -129,8 +126,8 @@
|
||||||
|
|
||||||
;; Send to the thread users
|
;; Send to the thread users
|
||||||
(doseq [mention thread-mentions]
|
(doseq [mention thread-mentions]
|
||||||
(let [{:keys [fullname email mention-email?]} (get team-users mention)]
|
(let [{:keys [fullname email props]} (get team-users mention)]
|
||||||
(when mention-email?
|
(when (mention-email? props)
|
||||||
(eml/send!
|
(eml/send!
|
||||||
{::eml/conn conn
|
{::eml/conn conn
|
||||||
::eml/factory eml/comment-thread
|
::eml/factory eml/comment-thread
|
||||||
|
@ -143,8 +140,8 @@
|
||||||
|
|
||||||
;; Send to users with the "all" flag activated
|
;; Send to users with the "all" flag activated
|
||||||
(doseq [user-id notificate-users-ids]
|
(doseq [user-id notificate-users-ids]
|
||||||
(let [{:keys [fullname email notification-email?]} (get team-users user-id)]
|
(let [{:keys [id fullname email props]} (get team-users user-id)]
|
||||||
(when notification-email?
|
(when (notification-email? id (:owner-id thread) props)
|
||||||
(eml/send!
|
(eml/send!
|
||||||
{::eml/conn conn
|
{::eml/conn conn
|
||||||
::eml/factory eml/comment-notification
|
::eml/factory eml/comment-notification
|
||||||
|
@ -313,7 +310,7 @@
|
||||||
(defn- get-unread-comment-threads
|
(defn- get-unread-comment-threads
|
||||||
[conn profile-id team-id]
|
[conn profile-id team-id]
|
||||||
(let [profile (-> (db/get conn :profile {:id profile-id})
|
(let [profile (-> (db/get conn :profile {:id profile-id})
|
||||||
(decode-user-row))
|
(profile/decode-row))
|
||||||
notify (or (-> profile :props :notifications :dashboard-comments) :all)]
|
notify (or (-> profile :props :notifications :dashboard-comments) :all)]
|
||||||
|
|
||||||
(case notify
|
(case notify
|
||||||
|
|
|
@ -397,7 +397,7 @@
|
||||||
[:div
|
[:div
|
||||||
{:role "textbox"
|
{:role "textbox"
|
||||||
:class (stl/css :comment-input)
|
:class (stl/css :comment-input)
|
||||||
:content-editable "plaintext-only"
|
:content-editable (if (cfg/check-browser? :chrome) "plaintext-only" "true")
|
||||||
:suppress-content-editable-warning true
|
:suppress-content-editable-warning true
|
||||||
:on-input handle-input
|
:on-input handle-input
|
||||||
:ref init-input
|
:ref init-input
|
||||||
|
|
Loading…
Add table
Reference in a new issue