diff --git a/backend/resources/app/email/task-done/en.html b/backend/resources/app/email/task-done/en.html
new file mode 100644
index 0000000000..14f898084f
--- /dev/null
+++ b/backend/resources/app/email/task-done/en.html
@@ -0,0 +1,251 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ Hello {{name|abbreviate:25}}!
+ |
+
+
+ |
+
+ {{ source-user }} marked this task as done:
+ |
+
+
+ |
+
+ {{ task-title }}
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+
+ Open it to verify it, or reopen it if the work is not finished.
+ |
+
+
+ |
+
+ The Penpot team.
+ |
+
+
+
+
+ |
+
+
+
+
+
+ {% include "app/email/includes/footer.html" %}
+
+
+
+
+
diff --git a/backend/resources/app/email/task-done/en.subj b/backend/resources/app/email/task-done/en.subj
new file mode 100644
index 0000000000..b3d08b8c26
--- /dev/null
+++ b/backend/resources/app/email/task-done/en.subj
@@ -0,0 +1 @@
+A task is ready to verify
diff --git a/backend/resources/app/email/task-done/en.txt b/backend/resources/app/email/task-done/en.txt
new file mode 100644
index 0000000000..6f985b4457
--- /dev/null
+++ b/backend/resources/app/email/task-done/en.txt
@@ -0,0 +1,11 @@
+Hello {{name|abbreviate:25}}!
+
+{{ source-user }} marked this task as done:
+
+{{ task-title }}
+
+Open it to verify it, or reopen it if the work is not finished.
+
+{{ task-url }}
+
+The Penpot team.
diff --git a/backend/resources/app/email/task-reopened/en.html b/backend/resources/app/email/task-reopened/en.html
new file mode 100644
index 0000000000..615239ac6a
--- /dev/null
+++ b/backend/resources/app/email/task-reopened/en.html
@@ -0,0 +1,251 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ Hello {{name|abbreviate:25}}!
+ |
+
+
+ |
+
+ {{ source-user }} reopened this task:
+ |
+
+
+ |
+
+ {{ task-title }}
+
+ |
+
+
+ |
+
+ |
+
+
+ |
+
+ The work is back with you.
+ |
+
+
+ |
+
+ The Penpot team.
+ |
+
+
+
+
+ |
+
+
+
+
+
+ {% include "app/email/includes/footer.html" %}
+
+
+
+
+
diff --git a/backend/resources/app/email/task-reopened/en.subj b/backend/resources/app/email/task-reopened/en.subj
new file mode 100644
index 0000000000..2ee422a015
--- /dev/null
+++ b/backend/resources/app/email/task-reopened/en.subj
@@ -0,0 +1 @@
+A task is reopened
diff --git a/backend/resources/app/email/task-reopened/en.txt b/backend/resources/app/email/task-reopened/en.txt
new file mode 100644
index 0000000000..9392ebf248
--- /dev/null
+++ b/backend/resources/app/email/task-reopened/en.txt
@@ -0,0 +1,11 @@
+Hello {{name|abbreviate:25}}!
+
+{{ source-user }} reopened this task:
+
+{{ task-title }}
+
+The work is back with you.
+
+{{ task-url }}
+
+The Penpot team.
diff --git a/backend/src/app/email.clj b/backend/src/app/email.clj
index c19bda23be..5eb0ebba6c 100644
--- a/backend/src/app/email.clj
+++ b/backend/src/app/email.clj
@@ -606,6 +606,34 @@
:id ::tasks-moved
:schema schema:tasks-moved))
+(def ^:private schema:task-done
+ [:map
+ [:name ::sm/text]
+ [:source-user ::sm/text]
+ [:task-title ::sm/text]
+ [:task-url ::sm/text]])
+
+(def task-done
+ "Email sent to the author of a task when somebody marks it as done, so
+ they verify it."
+ (template-factory
+ :id ::task-done
+ :schema schema:task-done))
+
+(def ^:private schema:task-reopened
+ [:map
+ [:name ::sm/text]
+ [:source-user ::sm/text]
+ [:task-title ::sm/text]
+ [:task-url ::sm/text]])
+
+(def task-reopened
+ "Email sent to the assignee of a task when somebody reopens it: the
+ work is back with them."
+ (template-factory
+ :id ::task-reopened
+ :schema schema:task-reopened))
+
(def ^:private schema:comment-mention
[:map
[:name ::sm/text]
@@ -687,6 +715,8 @@
"comment-notification" (template-entry comment-notification schema:comment-notification)
"review-request" (template-entry review-request schema:review-request)
"task-assigned" (template-entry task-assigned schema:task-assigned)
+ "task-done" (template-entry task-done schema:task-done)
+ "task-reopened" (template-entry task-reopened schema:task-reopened)
"tasks-moved" (template-entry tasks-moved schema:tasks-moved)})
(defn render-template
diff --git a/backend/src/app/migrations.clj b/backend/src/app/migrations.clj
index b6a912fd95..148b478ff7 100644
--- a/backend/src/app/migrations.clj
+++ b/backend/src/app/migrations.clj
@@ -593,7 +593,10 @@
:fn (mg/resource "app/migrations/sql/0814-mod-file-task-give-thread.sql")}
{:name "0815-add-file-branch-change-review-table"
- :fn (mg/resource "app/migrations/sql/0815-add-file-branch-change-review-table.sql")}])
+ :fn (mg/resource "app/migrations/sql/0815-add-file-branch-change-review-table.sql")}
+
+ {:name "0816-mod-file-task-add-created-thread"
+ :fn (mg/resource "app/migrations/sql/0816-mod-file-task-add-created-thread.sql")}])
(defn apply-migrations!
[pool name migrations]
diff --git a/backend/src/app/migrations/sql/0816-mod-file-task-add-created-thread.sql b/backend/src/app/migrations/sql/0816-mod-file-task-add-created-thread.sql
new file mode 100644
index 0000000000..c3d0d64571
--- /dev/null
+++ b/backend/src/app/migrations/sql/0816-mod-file-task-add-created-thread.sql
@@ -0,0 +1,13 @@
+-- A task created on the canvas gets a thread whose first message is its
+-- title. A task made from a message of a thread someone already wrote
+-- keeps that thread and that message. The code derived the difference from
+-- the message being the first of the thread, which is equally true of a
+-- task made from the first message of an existing thread: relinking such
+-- a task moved a thread its author never gave it, and a rename would
+-- rewrite a message its author did not write.
+--
+-- Record the fact instead. No backfill: the databases of this line are
+-- recreated from the migrations.
+
+ALTER TABLE file_task
+ ADD COLUMN created_thread boolean NOT NULL DEFAULT false;
diff --git a/backend/src/app/rpc/commands/comments.clj b/backend/src/app/rpc/commands/comments.clj
index 9a94b205e6..83e426de72 100644
--- a/backend/src/app/rpc/commands/comments.clj
+++ b/backend/src/app/rpc/commands/comments.clj
@@ -100,7 +100,11 @@
(not= :none (-> props :notifications :email-comments)))
(defn send-comment-emails!
- [{:keys [::db/conn] :as cfg} profile comment thread file]
+ "Tell by email the people a comment concerns: the ones it mentions, the
+ ones the thread mentions and, unless `skip-subscriber-emails` is set,
+ the members with all comments on. A task created on the canvas sets it,
+ so its thread sends the task email and no comment email."
+ [{:keys [::db/conn] :as cfg} profile comment thread file & {:keys [skip-subscriber-emails]}]
(let [team-users (get-team-users conn (:team-id file))
comment-reference (format-comment-ref thread file)
comment-content (format-comment comment)
@@ -159,20 +163,21 @@
:comment-url comment-url}))))
;; Send to users with the "all" flag activated
- (doseq [user-id notificate-users-ids]
- (let [{:keys [id fullname email props]} (get team-users user-id)]
- (when (notification-email? id (:owner-id thread) props)
- (eml/send-template
- cfg
- {::eml/reuse-conn true
- ::eml/template "comment-notification"
- :public-uri (cf/get :public-uri)
- :to email
- :name fullname
- :source-user (:fullname profile)
- :comment-reference comment-reference
- :comment-content comment-content
- :comment-url comment-url}))))))
+ (when-not skip-subscriber-emails
+ (doseq [user-id notificate-users-ids]
+ (let [{:keys [id fullname email props]} (get team-users user-id)]
+ (when (notification-email? id (:owner-id thread) props)
+ (eml/send-template
+ cfg
+ {::eml/reuse-conn true
+ ::eml/template "comment-notification"
+ :public-uri (cf/get :public-uri)
+ :to email
+ :name fullname
+ :source-user (:fullname profile)
+ :comment-reference comment-reference
+ :comment-content comment-content
+ :comment-url comment-url})))))))
(defn- decode-row
[{:keys [participants position mentions area anchor-type] :as row}]
@@ -551,9 +556,11 @@
"Create a thread with its first message on the page `page-id` of
`file-id`, once the quotes of threads and comments allow it. It joins
the transaction of `cfg` when there is one: a task created on the canvas
- gets its thread this way (`app.rpc.commands.files-task`). The caller
- checks the permissions. Returns the thread with the id of its first
- message (`:comment-id`)."
+ gets its thread this way (`app.rpc.commands.files-task`), with
+ `::skip-subscriber-emails` set so the thread sends no email to the
+ members with all comments on (the ones it mentions are still told). The
+ caller checks the permissions. Returns the thread with the id of its
+ first message (`:comment-id`)."
[cfg {:keys [::rpc/profile-id file-id page-id] :as params}]
(let [{:keys [team-id project-id] :as file} (get-file cfg file-id page-id)]
(-> cfg
@@ -576,12 +583,14 @@
[cfg {:keys [::rpc/profile-id file-id page-id share-id] :as params}]
(let [perms (files/check-comment-permissions! cfg profile-id file-id share-id)]
(check-page-scope perms page-id)
- (create-comment-thread cfg params)))
+ ;; The flag belongs to the backend callers: a client may not silence
+ ;; the emails of its team.
+ (create-comment-thread cfg (dissoc params ::skip-subscriber-emails))))
(defn- insert-comment-thread
[{:keys [::db/conn] :as cfg}
{:keys [::rpc/profile-id ::rpc/request-at ::file position content mentions frame-id
- pull-request-id anchor]}]
+ pull-request-id anchor ::skip-subscriber-emails]}]
(let [;; NOTE: we take the next seq number from a separate query
;; because we need to lock the file for avoid race conditions
@@ -636,7 +645,8 @@
(update-thread-seqn conn file-id seqn)
;; Send mentions emails
- (send-comment-emails! cfg profile comment thread file)
+ (send-comment-emails! cfg profile comment thread file
+ :skip-subscriber-emails skip-subscriber-emails)
(-> thread
(add-owner profile)
@@ -825,15 +835,35 @@
thread_id = NULL,
comment_id = NULL
WHERE thread_id = ?
- AND deleted_at IS NULL")
+ AND deleted_at IS NULL
+ RETURNING id, title")
+
+(defn- insert-task-event
+ "Record an event of a task that a thread delete removes, encoded as the
+ task commands of `app.rpc.commands.files-task` encode theirs. That
+ namespace owns the events, but it requires this one to create the thread
+ of a task, so the insert is repeated here instead of closing a cycle."
+ [conn task-id profile-id type payload]
+ (db/insert! conn :file-task-event
+ {:id (uuid/next)
+ :task-id task-id
+ :profile-id profile-id
+ :type type
+ :payload (some-> payload db/tjson)
+ :created-at (ct/now)}
+ {::db/return-keys false}))
(defn- delete-thread-tasks
- "Delete the tasks of the thread `thread-id`, which live in its messages,
- and tell the open clients of `file-id` once the transaction commits."
+ "Delete the tasks of the thread `thread-id`, which live in its messages.
+ Each one gets a `deleted` event first, since the row loses the thread and
+ the message it lived in, and the open clients of `file-id` are told once
+ the transaction commits."
[{:keys [::db/conn ::mbus/msgbus]} profile-id file-id thread-id]
- (let [ts (ct/now)
- result (db/exec-one! conn [sql:delete-thread-tasks ts ts thread-id])]
- (when (pos? (db/get-update-count result))
+ (let [ts (ct/now)
+ tasks (db/exec! conn [sql:delete-thread-tasks ts ts thread-id])]
+ (doseq [{:keys [id title]} tasks]
+ (insert-task-event conn id profile-id "deleted" {:title title}))
+ (when (seq tasks)
(db/after-commit
#(mbus/pub! msgbus
:topic file-id
diff --git a/backend/src/app/rpc/commands/files_task.clj b/backend/src/app/rpc/commands/files_task.clj
index d656fa3757..e3a4346f8d 100644
--- a/backend/src/app/rpc/commands/files_task.clj
+++ b/backend/src/app/rpc/commands/files_task.clj
@@ -10,11 +10,12 @@
Every task lives in a message of a comment thread, so its thread can
go on: a task made from a message keeps that thread, and a task
- created on the canvas gets a thread whose first message is its title.
- A task may also belong to a design review. Everybody who can read the
- file may create a task and move it between states; every move is
- recorded as an event of the task with who made it, which is what the
- thread of the task shows between its comments.
+ created on the canvas gets a thread whose first message is its title
+ (`created-thread` records which). A task may also belong to a design
+ review. Everybody who can read the file may create a task and move it
+ between states; every move is recorded as an event of the task with
+ who made it, which is what the thread of the task shows between its
+ comments.
The merge of a branch moves its tasks into main (`move-branch-tasks`,
called from `app.rpc.commands.files-branch`): the open ones keep going
@@ -124,6 +125,7 @@
t.status,
t.assignee_id,
t.created_by,
+ t.created_thread,
t.page_id,
t.frame_id,
t.shape_id,
@@ -213,25 +215,71 @@
:team-id team-id
:task-id id})]))
+(defn- team-users
+ "The users of `team-id` by id, with their props: the task emails read
+ the notification setting of each one."
+ [conn team-id]
+ (->> (teams/get-users+props conn team-id)
+ (map profile/decode-row)
+ (d/index-by :id)))
+
+(defn- task-emails?
+ "Whether the task emails of a file reach the profile with `props`:
+ `:none` refuses them all, and the rest (an absent setting counts as
+ `:partial`) admit them."
+ [props]
+ (not= :none (-> props :notifications :email-tasks)))
+
(defn- send-task-assigned-email
"Tell `assignee-id` that `actor-id` assigned the task to them. Nobody is
- told about the tasks they assign to themselves."
+ told about the tasks they assign to themselves, and a profile that
+ refuses the task emails is told nothing."
[{:keys [::db/conn] :as cfg} team-id actor-id {:keys [assignee-id title] :as task}]
(when (and (some? assignee-id) (not= assignee-id actor-id))
- (let [users (->> (teams/get-users+props conn team-id)
- (map profile/decode-row)
- (d/index-by :id))]
- (when-let [{:keys [fullname email]} (get users assignee-id)]
- (eml/send-template
- cfg
- {::eml/reuse-conn true
- ::eml/template "task-assigned"
- :public-uri (cf/get :public-uri)
- :to email
- :name fullname
- :source-user (get-in users [actor-id :fullname] "")
- :task-title title
- :task-url (format-task-url task team-id)})))))
+ (let [users (team-users conn team-id)]
+ (when-let [{:keys [fullname email props]} (get users assignee-id)]
+ (when (task-emails? props)
+ (eml/send-template
+ cfg
+ {::eml/reuse-conn true
+ ::eml/template "task-assigned"
+ :public-uri (cf/get :public-uri)
+ :to email
+ :name fullname
+ :source-user (get-in users [actor-id :fullname] "")
+ :task-title title
+ :task-url (format-task-url task team-id)}))))))
+
+(def ^:private status-email
+ "The mail a move of a task sends, and the person it tells: the creator
+ when the task is done, the assignee when it is reopened. The other
+ moves (verified, won't do) tell nobody."
+ {"done" {:recipient :created-by :template "task-done"}
+ "reopened" {:recipient :assignee-id :template "task-reopened"}})
+
+(defn- send-task-status-email
+ "Tell the person a move of `task` concerns about it: its creator when
+ it is done, its assignee when it is reopened. Nobody is told about
+ their own move, and a profile that refuses the task emails is told
+ nothing."
+ [{:keys [::db/conn] :as cfg} actor-id {:keys [status file-id] :as task}]
+ (when-let [{:keys [recipient template]} (get status-email status)]
+ (when-let [recipient-id (get task recipient)]
+ (when (not= recipient-id actor-id)
+ (let [team-id (perms/get-team-id-for-file conn file-id)
+ users (team-users conn team-id)]
+ (when-let [{:keys [fullname email props]} (get users recipient-id)]
+ (when (task-emails? props)
+ (eml/send-template
+ cfg
+ {::eml/reuse-conn true
+ ::eml/template template
+ :public-uri (cf/get :public-uri)
+ :to email
+ :name fullname
+ :source-user (get-in users [actor-id :fullname] "")
+ :task-title (:title task)
+ :task-url (format-task-url task team-id)}))))))))
;; --- COMMAND QUERY: get-file-tasks
@@ -341,7 +389,9 @@
(defn- create-task-thread
"The thread of a task created on the canvas: its first message is the
title, it points at the layer of the task (at the spot of the canvas
- when there is none) and belongs to the design review of the task."
+ when there is none) and belongs to the design review of the task. The
+ task tells its assignee by email, so the thread tells nobody that a
+ comment was added."
[cfg profile-id {:keys [file-id title page-id frame-id shape-id position pull-request-id]}]
(comments/create-comment-thread
cfg
@@ -352,6 +402,7 @@
:frame-id frame-id
:position position
:content title
+ ::comments/skip-subscriber-emails true
:anchor (if (some? shape-id)
{:type :layer :shape-id shape-id}
{:type :canvas})}
@@ -362,8 +413,9 @@
message it was made from (`thread-id` and `comment-id`), or the first
message of a new thread that carries its title. A task created in a
design review belongs to it. The assignee, when there is one, must be
- a member of the team and is told by email. A deleted file takes no
- task: a merge deletes its branch file (see `lock-file`)."
+ a member of the team and is told by email. The thread created with the
+ task sends no comment email of its own. A deleted file takes no task:
+ a merge deletes its branch file (see `lock-file`)."
{::doc/added "2.16"
::webhooks/event? true
::sm/params schema:create-task}
@@ -402,6 +454,7 @@
:review-title (:title review)
:thread-id (or thread-id (:id thread))
:comment-id (or comment-id (:comment-id thread))
+ :created-thread (some? thread)
:title (str/trim title)
:status "open"
:assignee-id assignee-id
@@ -420,6 +473,31 @@
(send-task-assigned-email cfg team-id profile-id task)
task))))
+;; --- Helpers: the message of a task
+
+(defn- rename-task-message
+ "Rewrite the message of `task`, the first message of the thread the task
+ created, so the thread reads with the new `title`. Only the profile that
+ wrote the message renames it: anybody who can read the file may rename
+ a task, and that must not let them rewrite somebody else's words. A
+ task made from a message of an existing thread keeps that message as it
+ is. The message and its thread take the new modified time, as
+ `update-comment` makes them. The mentions stay: the message of a task
+ created on the canvas carries none, and a rename adds none."
+ [conn profile-id {:keys [comment-id thread-id created-thread title]} ts]
+ (when (and created-thread (some? comment-id))
+ (let [comment (db/get* conn :comment {:id comment-id} {::sql/for-update true})]
+ (when (and (some? comment) (= profile-id (:owner-id comment)))
+ (db/update! conn :comment
+ {:content title :modified-at ts}
+ {:id comment-id}
+ {::db/return-keys false})
+ (when (some? thread-id)
+ (db/update! conn :comment-thread
+ {:modified-at ts}
+ {:id thread-id}
+ {::db/return-keys false}))))))
+
;; --- COMMAND: update-task
(def ^:private schema:update-task
@@ -431,7 +509,9 @@
(sv/defmethod ::update-task
"Rename a task or change its assignee. Each change is an event of the
- task; a new assignee is told by email."
+ task, and a new assignee is told by email. A rename also rewrites the
+ first message of the thread the task created when the renamer wrote
+ it, so the thread reads with the new title."
{::doc/added "2.16"
::sm/params schema:update-task}
[cfg {:keys [::rpc/profile-id ::rpc/session-id id title] :as params}]
@@ -451,7 +531,8 @@
reassign? (and (contains? params :assignee-id)
(not= (:assignee-id params) (:assignee-id task)))
rename? (and (some? title) (not= (str/trim title) (:title task)))
- changes (cond-> {:updated-at (ct/now)}
+ ts (ct/now)
+ changes (cond-> {:updated-at ts}
rename? (assoc :title (str/trim title))
reassign? (assoc :assignee-id (:assignee-id params)))
task (merge task changes)]
@@ -459,7 +540,8 @@
(check-assignee conn team-id (:assignee-id params)))
(db/update! conn :file-task changes {:id id} {::db/return-keys false})
(when rename?
- (insert-event conn id profile-id "renamed" {:title (:title task)}))
+ (insert-event conn id profile-id "renamed" {:title (:title task)})
+ (rename-task-message conn profile-id task ts))
(when reassign?
(insert-event conn id profile-id "assigned" {:assignee-id (:assignee-id task)})
(send-task-assigned-email cfg team-id profile-id task))
@@ -474,7 +556,9 @@
(sv/defmethod ::set-task-status
"Move a task to another state (see `transitions`). Anybody who can read
- the file may do it; the event records who did."
+ the file may do it, and the event records who did. The creator of the
+ task is told by email when it is done and its assignee when it is
+ reopened."
{::doc/added "2.16"
::webhooks/event? true
::sm/params schema:set-task-status}
@@ -485,7 +569,7 @@
(run-and-notify
cfg {:file-id (:file-id task) :profile-id profile-id :session-id session-id}
(comp vector :id)
- (fn [{:keys [::db/conn]}]
+ (fn [{:keys [::db/conn] :as cfg}]
(let [task (get-task conn id {::sql/for-update true})
from (:status task)
ts (ct/now)]
@@ -503,34 +587,22 @@
{:id id}
{::db/return-keys false})
(insert-event conn id profile-id "status" {:from from :to status})
- (assoc task
- :status status
- :status-changed-at ts
- :status-changed-by profile-id))))))
+ (let [task (assoc task
+ :status status
+ :status-changed-at ts
+ :status-changed-by profile-id)]
+ (send-task-status-email cfg profile-id task)
+ task))))))
;; --- Helpers: the thread created with a task
-(def ^:private sql:get-first-comment
- "SELECT id FROM comment
- WHERE thread_id = ?
- ORDER BY created_at ASC, id ASC
- LIMIT 1")
-
-(defn- created-with-task?
- "The thread of `task` was created with it: the message of the task is
- the first message of the thread. A thread a task was made from later
- keeps its own place."
- [conn {:keys [thread-id comment-id]}]
- (and (some? thread-id)
- (some? comment-id)
- (= comment-id (:id (db/exec-one! conn [sql:get-first-comment thread-id])))))
-
(defn- move-task-thread
"Point the thread created with `task` where the task points now: at the
layer `shape-id`; with no layer, at the rectangle `area` of the canvas,
- or at the spot `position` when there is no area either."
+ or at the spot `position` when there is no area either. A thread the
+ task was made from keeps its own place."
[conn task {:keys [frame-id shape-id area position]}]
- (when (created-with-task? conn task)
+ (when (:created-thread task)
(db/update! conn :comment-thread
(cond
(some? shape-id)
@@ -709,22 +781,32 @@
[:map {:title "delete-task" :closed true}
[:id ::sm/uuid]])
+(defn- check-delete-permissions
+ "Deleting a task is allowed to its author and to the team admins and
+ owners of the file, which may clean up after someone who left the team.
+ Everybody else gets the same refusal, and a profile that cannot read
+ the file gets the usual not-found."
+ [cfg profile-id {:keys [id created-by file-id]}]
+ (let [perms (perms/get-file-read-permissions cfg profile-id file-id)]
+ (files/check-read-permissions! perms)
+ (when-not (or (= created-by profile-id) (:is-admin perms))
+ (ex/raise :type :validation
+ :code :not-allowed
+ :hint "only the author of a task or a team admin may delete it"
+ :task-id id))))
+
(sv/defmethod ::delete-task
- "Delete a task. Only its author may; anybody who can read the file may
- still move it to won't do. A `deleted` event, written before the task
- goes, records who deleted it. Its thread stays: the message the task
- lived in goes on as a plain comment."
+ "Delete a task. Its author and the team admins and owners of the file
+ may. Anybody who can read the file may still move it to won't do. A
+ `deleted` event, written before the task goes, records who deleted it.
+ Its thread stays: the message the task lived in goes on as a plain
+ comment."
{::doc/added "2.16"
::sm/params schema:delete-task}
[cfg {:keys [::rpc/profile-id ::rpc/session-id id]}]
(check-tasks-enabled)
(let [task (db/run! cfg (fn [{:keys [::db/conn]}] (get-task conn id)))]
- (files/check-read-permissions! cfg profile-id (:file-id task))
- (when (not= profile-id (:created-by task))
- (ex/raise :type :validation
- :code :not-allowed
- :hint "only the author of a task may delete it"
- :task-id id))
+ (check-delete-permissions cfg profile-id task)
(run-and-notify
cfg {:file-id (:file-id task) :profile-id profile-id :session-id session-id}
(constantly [id])
@@ -808,29 +890,28 @@
(defn- send-tasks-moved-emails
[{:keys [::db/conn] :as cfg} {:keys [team-id main-id actor-id branch-name file-name]} tasks]
- (let [users (->> (teams/get-users+props conn team-id)
- (map profile/decode-row)
- (d/index-by :id))
+ (let [users (team-users conn team-id)
actor (get-in users [actor-id :fullname] "")]
(doseq [[assignee-id tasks] (group-by :assignee-id tasks)]
- (when-let [{:keys [fullname email]} (and (some? assignee-id)
- (not= assignee-id actor-id)
- (get users assignee-id))]
- (eml/send-template
- cfg
- {::eml/reuse-conn true
- ::eml/template "tasks-moved"
- :public-uri (cf/get :public-uri)
- :to email
- :name fullname
- :source-user actor
- :branch-name branch-name
- :file-name file-name
- :task-titles (str/join "\n" (map #(str "- " (:title %)) tasks))
- :file-url (str/join [(cf/get :public-uri)
- "/#/workspace?"
- (uri/map->query-string {:file-id main-id
- :team-id team-id})])})))))
+ (when-let [{:keys [fullname email props]} (and (some? assignee-id)
+ (not= assignee-id actor-id)
+ (get users assignee-id))]
+ (when (task-emails? props)
+ (eml/send-template
+ cfg
+ {::eml/reuse-conn true
+ ::eml/template "tasks-moved"
+ :public-uri (cf/get :public-uri)
+ :to email
+ :name fullname
+ :source-user actor
+ :branch-name branch-name
+ :file-name file-name
+ :task-titles (str/join "\n" (map #(str "- " (:title %)) tasks))
+ :file-url (str/join [(cf/get :public-uri)
+ "/#/workspace?"
+ (uri/map->query-string {:file-id main-id
+ :team-id team-id})])}))))))
(defn- find-shape
[data page-id shape-id]
diff --git a/backend/src/app/rpc/commands/profile.clj b/backend/src/app/rpc/commands/profile.clj
index 35b4eff985..d70a93d5fe 100644
--- a/backend/src/app/rpc/commands/profile.clj
+++ b/backend/src/app/rpc/commands/profile.clj
@@ -44,10 +44,14 @@
(declare strip-private-attrs)
(def schema:props-notifications
+ "The email choices of a profile. `:email-tasks` is optional because a
+ profile saved before the key existed does not have it, and the readers
+ of the setting take a missing one as `:partial`."
[:map {:title "props-notifications"}
[:dashboard-comments [::sm/one-of #{:all :partial :none}]]
[:email-comments [::sm/one-of #{:all :partial :none}]]
- [:email-invites [::sm/one-of #{:all :none}]]])
+ [:email-invites [::sm/one-of #{:all :none}]]
+ [:email-tasks {:optional true} [::sm/one-of #{:all :partial :none}]]])
(def schema:nudge
[:map {:title "Nudge"}
@@ -263,7 +267,8 @@
[:map {:title "update-profile-notifications"}
[:dashboard-comments [::sm/one-of #{:all :partial :none}]]
[:email-comments [::sm/one-of #{:all :partial :none}]]
- [:email-invites [::sm/one-of #{:all :none}]]])
+ [:email-invites [::sm/one-of #{:all :none}]]
+ [:email-tasks {:optional true} [::sm/one-of #{:all :partial :none}]]])
(declare update-notifications!)
@@ -275,14 +280,19 @@
(db/tx-run! cfg update-notifications! (assoc params :profile-id profile-id)))
(defn- update-notifications!
- [{:keys [::db/conn] :as cfg} {:keys [profile-id dashboard-comments email-comments email-invites]}]
+ [{:keys [::db/conn] :as cfg} {:keys [profile-id dashboard-comments email-comments email-invites email-tasks]}]
(let [profile
(get-profile conn profile-id ::db/for-update true)
+ ;; A client that predates `:email-tasks` does not send it: the
+ ;; stored choice stays as the user left it.
notifications
- {:dashboard-comments dashboard-comments
- :email-comments email-comments
- :email-invites email-invites}
+ (merge (get-in profile [:props :notifications])
+ {:dashboard-comments dashboard-comments
+ :email-comments email-comments
+ :email-invites email-invites}
+ (when (some? email-tasks)
+ {:email-tasks email-tasks}))
props
(-> (get profile :props)
diff --git a/backend/test/backend_tests/rpc_comment_test.clj b/backend/test/backend_tests/rpc_comment_test.clj
index 9b29853c75..1e69e8aac7 100644
--- a/backend/test/backend_tests/rpc_comment_test.clj
+++ b/backend/test/backend_tests/rpc_comment_test.clj
@@ -9,7 +9,9 @@
[app.common.geom.point :as gpt]
[app.common.time :as ct]
[app.common.uuid :as uuid]
+ [app.config :as cf]
[app.db :as db]
+ [app.email :as eml]
[app.http :as http]
[app.rpc :as-alias rpc]
[app.rpc.commands.comments :as comments]
@@ -1084,3 +1086,98 @@
result ((deref #'comments/get-file) th/*system* (:id file) page-id)]
(t/is (not (contains? result :storage-object-id)))))
+
+(t/deftest thread-created-for-a-task-sends-no-comment-notification
+ ;; A task created on the canvas makes its thread with
+ ;; `::comments/skip-subscriber-emails`: the task email is the only one the
+ ;; creation sends, while the people the message mentions are still told.
+ (let [owner (th/create-profile* 1 {:is-active true})
+ member (th/create-profile* 2 {:is-active true})
+ mentioned (th/create-profile* 3 {:is-active true})
+ team (th/create-team* 1 {:profile-id (:id owner)})
+ project (th/create-project* 1 {:team-id (:id team)
+ :profile-id (:id owner)})
+ file (th/create-file* 1 {:profile-id (:id owner)
+ :project-id (:id project)})
+ page-id (get-in file [:data :pages 0])
+ sent (atom [])]
+
+ (th/create-team-role* {:team-id (:id team)
+ :profile-id (:id member)
+ :role :editor})
+ (th/create-team-role* {:team-id (:id team)
+ :profile-id (:id mentioned)
+ :role :editor})
+ (th/db-update! :profile
+ {:props (db/tjson {:notifications {:dashboard-comments :all
+ :email-comments :all
+ :email-invites :all}})}
+ {:id (:id member)})
+
+ (let [create-thread! (fn [params]
+ (comments/create-comment-thread
+ th/*system*
+ (merge {::rpc/profile-id (:id owner)
+ ::rpc/request-at (ct/now)
+ :file-id (:id file)
+ :page-id page-id
+ :position (gpt/point 0)
+ :frame-id uuid/zero}
+ params)))]
+
+ (with-redefs [eml/send-template (fn [_ params]
+ (swap! sent conj (::eml/template params))
+ nil)]
+ (t/testing "the flag silences the subscribers and keeps the mentions"
+ (create-thread! {::comments/skip-subscriber-emails true
+ :content (str "for you @[Profile 3](" (:id mentioned) ")")
+ :mentions #{(:id mentioned)}})
+ (t/is (= ["comment-mention"] @sent)))
+
+ (t/testing "without the flag the subscriber is told"
+ (reset! sent [])
+ (create-thread! {:content "hello again"})
+ (t/is (= ["comment-notification"] @sent)))))))
+
+(t/deftest deleting-a-thread-records-a-deleted-event-for-its-tasks
+ ;; The tasks of a thread live in its messages and go with it: each one
+ ;; records who removed it, as the delete of a single task does.
+ (with-redefs [cf/flags (conj cf/flags :branching)]
+ (let [profile (th/create-profile* 1 {:is-active true})
+ team (th/create-team* 1 {:profile-id (:id profile)})
+ project (th/create-project* 1 {:team-id (:id team)
+ :profile-id (:id profile)})
+ file (th/create-file* 1 {:profile-id (:id profile)
+ :project-id (:id project)})
+ page-id (get-in file [:data :pages 0])
+
+ thread (:result (th/command! {::th/type :create-comment-thread
+ ::rpc/profile-id (:id profile)
+ :file-id (:id file)
+ :page-id page-id
+ :position (gpt/point 0)
+ :content "A thread with a task"
+ :frame-id uuid/zero}))
+
+ task (:result (th/command! {::th/type :create-task
+ ::rpc/profile-id (:id profile)
+ :file-id (:id file)
+ :page-id page-id
+ :frame-id uuid/zero
+ :position (gpt/point 0)
+ :title "Pay button"
+ :thread-id (:id thread)
+ :comment-id (:comment-id thread)}))]
+
+ (t/is (uuid? (:id task)))
+
+ (t/is (th/success? (th/command! {::th/type :delete-comment-thread
+ ::rpc/profile-id (:id profile)
+ :id (:id thread)})))
+
+ (let [deleted (->> (th/db-query :file-task-event {:task-id (:id task)})
+ (filter #(= "deleted" (:type %))))]
+ (t/is (= 1 (count deleted)))
+ (t/is (= (:id profile) (:profile-id (first deleted))))
+ (t/is (= {:title "Pay button"}
+ (db/decode-transit-pgobject (:payload (first deleted)))))))))
diff --git a/backend/test/backend_tests/rpc_file_task_test.clj b/backend/test/backend_tests/rpc_file_task_test.clj
index 5639dd6d8d..4e8b54ee53 100644
--- a/backend/test/backend_tests/rpc_file_task_test.clj
+++ b/backend/test/backend_tests/rpc_file_task_test.clj
@@ -745,6 +745,40 @@
(:id task)])]
(t/is (= [(:id author)] (mapv :profile-id rows))))))))
+(t/deftest a-team-owner-or-admin-may-delete-the-task-of-somebody-else
+ (with-redefs [cf/flags (task-flags)]
+ (let [{:keys [author reviewer page-id branch-file-id]} (setup-review)
+ admin (th/create-profile* 3 {:is-active true})
+ _ (th/create-team-role* {:team-id (:default-team-id author)
+ :profile-id (:id admin)
+ :role :admin})
+ task* (fn [profile]
+ (:result (create-task* profile {:file-id branch-file-id :page-id page-id})))
+ delete (fn [profile task]
+ (th/command! {::th/type :delete-task
+ ::rpc/profile-id (:id profile)
+ :id (:id task)}))
+ actor (fn [task]
+ (->> (th/db-exec! ["SELECT profile_id FROM file_task_event
+ WHERE task_id = ? AND type = 'deleted'"
+ (:id task)])
+ (mapv :profile-id)))]
+
+ (t/testing "the owner of the team may delete the task of an editor"
+ (let [task (task* reviewer)]
+ (t/is (nil? (:error (delete author task))))
+ (t/is (= [(:id author)] (actor task)))))
+
+ (t/testing "an admin of the team may delete the task of somebody else"
+ (let [task (task* reviewer)]
+ (t/is (nil? (:error (delete admin task))))
+ (t/is (= [(:id admin)] (actor task)))))
+
+ (t/testing "an editor who is not the author may not"
+ (let [task (task* author)]
+ (t/is (= :not-allowed (-> (delete reviewer task) :error ex-data :code)))
+ (t/is (nil? (:deleted-at (th/db-get :file-task {:id (:id task)})))))))))
+
;; --- Relinking a task
(t/deftest relinking-a-task-moves-the-thread-it-was-created-with
@@ -791,3 +825,144 @@
(t/is (nil? (:error (relink task))))
(t/is (= rect-id (:shape-id (th/db-get :comment-thread {:id (:id thread)}))))
(t/is (= other-id (:shape-id (th/db-get :file-task {:id (:id task)})))))))))
+
+(t/deftest relinking-a-task-made-from-the-first-message-leaves-its-thread
+ (with-redefs [cf/flags (task-flags)]
+ (let [{:keys [author page-id rect-id branch-file-id]} (setup-review)
+ other-id (uuid/random)
+ thread (:result (th/command! {::th/type :create-comment-thread
+ ::rpc/profile-id (:id author)
+ :file-id branch-file-id
+ :page-id page-id
+ :frame-id uuid/zero
+ :position (gpt/point 0)
+ :content "the radius is off"
+ :anchor {:type :layer :shape-id rect-id}}))
+ task (:result (create-task* author {:file-id branch-file-id
+ :page-id page-id
+ :shape-id rect-id
+ :thread-id (:id thread)
+ :comment-id (:comment-id thread)}))]
+ (add-rect* author branch-file-id page-id other-id "Promo")
+ (t/is (false? (:created-thread (th/db-get :file-task {:id (:id task)}))))
+ (t/is (nil? (:error (th/command! {::th/type :relink-task
+ ::rpc/profile-id (:id author)
+ :id (:id task)
+ :page-id page-id
+ :frame-id uuid/zero
+ :shape-id other-id
+ :shape-name "Promo"}))))
+ (t/is (= rect-id (:shape-id (th/db-get :comment-thread {:id (:id thread)}))))
+ (t/is (= other-id (:shape-id (th/db-get :file-task {:id (:id task)})))))))
+
+;; --- Renaming a task
+
+(defn- messages-of
+ [profile thread-id]
+ (mapv :content (:result (th/command! {::th/type :get-comments
+ ::rpc/profile-id (:id profile)
+ :thread-id thread-id}))))
+
+(defn- renamed-titles
+ [profile task]
+ (->> (:result (th/command! {::th/type :get-task-events
+ ::rpc/profile-id (:id profile)
+ :id (:id task)}))
+ (filter #(= "renamed" (:type %)))
+ (mapv #(-> % :payload :title))))
+
+(t/deftest renaming-a-task-rewrites-its-message-only-for-the-one-who-wrote-it
+ (with-redefs [cf/flags (task-flags)]
+ (let [{:keys [author reviewer page-id branch-file-id]} (setup-review)
+ rename (fn [profile task title]
+ (th/command! {::th/type :update-task
+ ::rpc/profile-id (:id profile)
+ :id (:id task)
+ :title title}))]
+
+ (t/testing "the author renames the message of a task created on the canvas"
+ (let [task (:result (create-task* author {:file-id branch-file-id
+ :page-id page-id
+ :title "first title"}))]
+ (t/is (nil? (:error (rename author task "second title"))))
+ (t/is (= "second title" (:title (th/db-get :file-task {:id (:id task)}))))
+ (t/is (= ["second title"] (messages-of author (:thread-id task))))
+ (t/is (= ["second title"] (renamed-titles author task)))))
+
+ (t/testing "somebody else renames the task but not its message"
+ (let [task (:result (create-task* author {:file-id branch-file-id
+ :page-id page-id
+ :title "the author's words"}))]
+ (t/is (nil? (:error (rename reviewer task "the reviewer's words"))))
+ (t/is (= "the reviewer's words" (:title (th/db-get :file-task {:id (:id task)}))))
+ (t/is (= ["the author's words"] (messages-of author (:thread-id task))))
+ (t/is (= ["the reviewer's words"] (renamed-titles author task)))))
+
+ (t/testing "the message of an existing thread stays whatever the title"
+ (let [thread (:result (th/command! {::th/type :create-comment-thread
+ ::rpc/profile-id (:id author)
+ :file-id branch-file-id
+ :page-id page-id
+ :frame-id uuid/zero
+ :position (gpt/point 0)
+ :content "the radius is off"}))
+ task (:result (create-task* author {:file-id branch-file-id
+ :page-id page-id
+ :thread-id (:id thread)
+ :comment-id (:comment-id thread)}))]
+ (t/is (false? (:created-thread (th/db-get :file-task {:id (:id task)}))))
+ (t/is (nil? (:error (rename author task "a better title"))))
+ (t/is (= ["the radius is off"] (messages-of author (:id thread))))
+ (t/is (= ["a better title"] (renamed-titles author task))))))))
+
+;; --- Emails of a move
+
+(t/deftest a-move-tells-the-person-it-concerns-and-nobody-else
+ (with-redefs [cf/flags (task-flags)]
+ (let [{:keys [author reviewer page-id branch-file-id]} (setup-review)
+ sent (atom [])]
+ (with-redefs [eml/send-template
+ (fn [_ params]
+ (swap! sent conj {:template (::eml/template params)
+ :to (:to params)
+ :task-title (:task-title params)}))]
+ (let [new-task (fn []
+ (:result (create-task* author {:file-id branch-file-id
+ :page-id page-id
+ :assignee-id (:id reviewer)})))
+ move (fn [profile task status]
+ (reset! sent [])
+ (let [out (set-status* profile (:id task) status)]
+ (t/is (nil? (:error out)))
+ @sent))]
+
+ (t/testing "done tells the creator"
+ (let [task (new-task)]
+ (t/is (= [{:template "task-done"
+ :to (:email author)
+ :task-title (:title task)}]
+ (move reviewer task "done")))))
+
+ (t/testing "a move that concerns only the actor tells nobody"
+ (let [task (new-task)]
+ (t/is (= [] (move author task "done")))))
+
+ (t/testing "reopened tells the assignee"
+ (let [task (new-task)]
+ (move reviewer task "done")
+ (t/is (= [{:template "task-reopened"
+ :to (:email reviewer)
+ :task-title (:title task)}]
+ (move author task "reopened")))))
+
+ (t/testing "verified tells nobody"
+ (let [task (new-task)]
+ (move reviewer task "done")
+ (t/is (= [] (move author task "verified")))))
+
+ (t/testing "a profile that refuses the task emails is told nothing"
+ (th/db-update! :profile
+ {:props (db/tjson {:notifications {:email-tasks :none}})}
+ {:id (:id author)})
+ (let [task (new-task)]
+ (t/is (= [] (move reviewer task "done"))))))))))
diff --git a/backend/test/backend_tests/rpc_profile_test.clj b/backend/test/backend_tests/rpc_profile_test.clj
index 25542b9845..89ce970593 100644
--- a/backend/test/backend_tests/rpc_profile_test.clj
+++ b/backend/test/backend_tests/rpc_profile_test.clj
@@ -1918,6 +1918,33 @@
(t/is (th/ex-of-code? (:error out) :props-too-large))))))
+(t/deftest update-profile-notifications-roundtrips-email-tasks
+ (let [profile (th/create-profile* 1)
+ stored (fn []
+ (-> (th/db-get :profile {:id (:id profile)})
+ (profile/decode-row)
+ (get-in [:props :notifications])))]
+
+ (t/testing "the task email choice is stored"
+ (let [out (th/command! {::th/type :update-profile-notifications
+ ::rpc/profile-id (:id profile)
+ :dashboard-comments :all
+ :email-comments :partial
+ :email-invites :all
+ :email-tasks :none})]
+ (t/is (nil? (:error out)))
+ (t/is (= :none (:email-tasks (stored))))))
+
+ (t/testing "a client that predates the key keeps the stored choice"
+ (let [out (th/command! {::th/type :update-profile-notifications
+ ::rpc/profile-id (:id profile)
+ :dashboard-comments :all
+ :email-comments :none
+ :email-invites :all})]
+ (t/is (nil? (:error out)))
+ (t/is (= :none (:email-tasks (stored))))
+ (t/is (= :none (:email-comments (stored))))))))
+
(t/deftest prepare-register-profile-password-too-short
(let [data {::th/type :prepare-register-profile
:email "user@example.com"
diff --git a/frontend/src/app/main/data/profile.cljs b/frontend/src/app/main/data/profile.cljs
index d68751ad78..cb2697b9d4 100644
--- a/frontend/src/app/main/data/profile.cljs
+++ b/frontend/src/app/main/data/profile.cljs
@@ -264,7 +264,8 @@
[:map {:title "NotificationsForm"}
[:dashboard-comments [::sm/one-of #{:all :partial :none}]]
[:email-comments [::sm/one-of #{:all :partial :none}]]
- [:email-invites [::sm/one-of #{:all :none}]]])
+ [:email-invites [::sm/one-of #{:all :none}]]
+ [:email-tasks [::sm/one-of #{:all :partial :none}]]])
(def ^:private check-update-notifications-params
(sm/check-fn schema:update-notifications))
diff --git a/frontend/src/app/main/ui/settings/notifications.cljs b/frontend/src/app/main/ui/settings/notifications.cljs
index 6bf42e5849..ab230790ca 100644
--- a/frontend/src/app/main/ui/settings/notifications.cljs
+++ b/frontend/src/app/main/ui/settings/notifications.cljs
@@ -19,7 +19,8 @@
(def default-notification-settings
{:dashboard-comments :all
:email-comments :partial
- :email-invites :all})
+ :email-invites :all
+ :email-tasks :partial})
(defn- on-submit
[form _event]
@@ -30,7 +31,8 @@
[:map {:title "NotificationsForm"}
[:dashboard-comments [::sm/one-of #{:all :partial :none}]]
[:email-comments [::sm/one-of #{:all :partial :none}]]
- [:email-invites [::sm/one-of #{:all :partial :none}]]])
+ [:email-invites [::sm/one-of #{:all :partial :none}]]
+ [:email-tasks [::sm/one-of #{:all :partial :none}]]])
(mf/defc notifications-page*
[{:keys [profile]}]
@@ -70,6 +72,15 @@
:name :email-comments
:class (stl/css :radio-btns)}]]
+ [:h4 (tr "dashboard.settings.notifications.email-tasks.title")]
+ [:div {:class (stl/css :fields-row)}
+ [:& fm/radio-buttons
+ {:options [{:label (tr "dashboard.settings.notifications.email-tasks.all") :value "all"}
+ {:label (tr "dashboard.settings.notifications.email-tasks.partial") :value "partial"}
+ {:label (tr "dashboard.settings.notifications.email-tasks.none") :value "none"}]
+ :name :email-tasks
+ :class (stl/css :radio-btns)}]]
+
[:h4 (tr "dashboard.settings.notifications.email-invites.title")]
[:div {:class (stl/css :fields-row)}
[:& fm/radio-buttons
diff --git a/frontend/src/app/main/ui/workspace/review/tasks.cljs b/frontend/src/app/main/ui/workspace/review/tasks.cljs
index a2e50a90ad..ce78cf8804 100644
--- a/frontend/src/app/main/ui/workspace/review/tasks.cljs
+++ b/frontend/src/app/main/ui/workspace/review/tasks.cljs
@@ -131,8 +131,15 @@
open? (deref open*)
status (:status task)
options (use-assignee-options)
+ team (mf/deref refs/team)
profile (mf/deref refs/profile)
+ ;; Its author, and the owner or an admin of its team, may delete a
+ ;; task; anybody who can read the file may still move it to won't do.
+ can-delete?
+ (or (= (:created-by task) (:id profile))
+ (boolean (get-in team [:permissions :is-admin])))
+
on-toggle
(mf/use-fn
(fn [event]
@@ -195,8 +202,7 @@
(when-not (dwtk/closed? task)
[:> menu-item* {:id "relink"}
(tr "workspace.tasks.actions.relink")])
- ;; only its author may delete a task
- (when (= (:id profile) (:created-by task))
+ (when can-delete?
[:> menu-item* {:id "delete"}
(tr "workspace.tasks.actions.delete")])]]))
diff --git a/frontend/translations/en.po b/frontend/translations/en.po
index 23818d99cd..ed93957bb9 100644
--- a/frontend/translations/en.po
+++ b/frontend/translations/en.po
@@ -1221,63 +1221,79 @@ msgstr "Penpot Light"
msgid "dashboard.select-ui-theme.system"
msgstr "System theme"
-#: src/app/main/ui/settings/notifications.cljs:57
+#: src/app/main/ui/settings/notifications.cljs:59
msgid "dashboard.settings.notifications.dashboard-comments.all"
msgstr "All comments, mentions and replies"
-#: src/app/main/ui/settings/notifications.cljs:59
+#: src/app/main/ui/settings/notifications.cljs:61
msgid "dashboard.settings.notifications.dashboard-comments.none"
msgstr "None"
-#: src/app/main/ui/settings/notifications.cljs:58
+#: src/app/main/ui/settings/notifications.cljs:60
msgid "dashboard.settings.notifications.dashboard-comments.partial"
msgstr "Only mentions and replies"
-#: src/app/main/ui/settings/notifications.cljs:54
+#: src/app/main/ui/settings/notifications.cljs:56
msgid "dashboard.settings.notifications.dashboard-comments.title"
msgstr "File comments"
-#: src/app/main/ui/settings/notifications.cljs:53
+#: src/app/main/ui/settings/notifications.cljs:55
msgid "dashboard.settings.notifications.dashboard.title"
msgstr "Dashboard Notifications"
-#: src/app/main/ui/settings/notifications.cljs:67
+#: src/app/main/ui/settings/notifications.cljs:69
msgid "dashboard.settings.notifications.email-comments.all"
msgstr "All comments, mentions and replies"
-#: src/app/main/ui/settings/notifications.cljs:69
+#: src/app/main/ui/settings/notifications.cljs:71
msgid "dashboard.settings.notifications.email-comments.none"
msgstr "None"
-#: src/app/main/ui/settings/notifications.cljs:68
+#: src/app/main/ui/settings/notifications.cljs:70
msgid "dashboard.settings.notifications.email-comments.partial"
msgstr "Only mentions and replies"
-#: src/app/main/ui/settings/notifications.cljs:64
+#: src/app/main/ui/settings/notifications.cljs:66
msgid "dashboard.settings.notifications.email-comments.title"
msgstr "File comments"
-#: src/app/main/ui/settings/notifications.cljs:76
+#: src/app/main/ui/settings/notifications.cljs:87
msgid "dashboard.settings.notifications.email-invites.all"
msgstr "All types of invites and requests"
-#: src/app/main/ui/settings/notifications.cljs:79
+#: src/app/main/ui/settings/notifications.cljs:90
msgid "dashboard.settings.notifications.email-invites.none"
msgstr "None"
-#: src/app/main/ui/settings/notifications.cljs:73
+#: src/app/main/ui/settings/notifications.cljs:84
msgid "dashboard.settings.notifications.email-invites.title"
msgstr "Invites and requests"
-#: src/app/main/ui/settings/notifications.cljs:63
+#: src/app/main/ui/settings/notifications.cljs:78
+msgid "dashboard.settings.notifications.email-tasks.all"
+msgstr "All tasks"
+
+#: src/app/main/ui/settings/notifications.cljs:80
+msgid "dashboard.settings.notifications.email-tasks.none"
+msgstr "None"
+
+#: src/app/main/ui/settings/notifications.cljs:79
+msgid "dashboard.settings.notifications.email-tasks.partial"
+msgstr "Only tasks I created or that are assigned to me"
+
+#: src/app/main/ui/settings/notifications.cljs:75
+msgid "dashboard.settings.notifications.email-tasks.title"
+msgstr "Tasks"
+
+#: src/app/main/ui/settings/notifications.cljs:65
msgid "dashboard.settings.notifications.email.title"
msgstr "Email Notifications"
-#: src/app/main/ui/settings/notifications.cljs:84
+#: src/app/main/ui/settings/notifications.cljs:95
msgid "dashboard.settings.notifications.submit"
msgstr "Update settings"
-#: src/app/main/ui/settings/notifications.cljs:52
+#: src/app/main/ui/settings/notifications.cljs:54
msgid "dashboard.settings.notifications.title"
msgstr "Notifications"
diff --git a/frontend/translations/es.po b/frontend/translations/es.po
index 0746453e74..ebc595c31a 100644
--- a/frontend/translations/es.po
+++ b/frontend/translations/es.po
@@ -1241,63 +1241,79 @@ msgstr "Penpot Light"
msgid "dashboard.select-ui-theme.system"
msgstr "Sistema"
-#: src/app/main/ui/settings/notifications.cljs:57
+#: src/app/main/ui/settings/notifications.cljs:59
msgid "dashboard.settings.notifications.dashboard-comments.all"
msgstr "Todos los comentarios, menciones y respuestas"
-#: src/app/main/ui/settings/notifications.cljs:59
+#: src/app/main/ui/settings/notifications.cljs:61
msgid "dashboard.settings.notifications.dashboard-comments.none"
msgstr "Ninguna"
-#: src/app/main/ui/settings/notifications.cljs:58
+#: src/app/main/ui/settings/notifications.cljs:60
msgid "dashboard.settings.notifications.dashboard-comments.partial"
msgstr "Sólo menciones y respuestas"
-#: src/app/main/ui/settings/notifications.cljs:54
+#: src/app/main/ui/settings/notifications.cljs:56
msgid "dashboard.settings.notifications.dashboard-comments.title"
msgstr "Comentarios de ficheros"
-#: src/app/main/ui/settings/notifications.cljs:53
+#: src/app/main/ui/settings/notifications.cljs:55
msgid "dashboard.settings.notifications.dashboard.title"
msgstr "Notificaciones en el panel"
-#: src/app/main/ui/settings/notifications.cljs:67
+#: src/app/main/ui/settings/notifications.cljs:69
msgid "dashboard.settings.notifications.email-comments.all"
msgstr "Todos los comentarios, menciones y respuestas"
-#: src/app/main/ui/settings/notifications.cljs:69
+#: src/app/main/ui/settings/notifications.cljs:71
msgid "dashboard.settings.notifications.email-comments.none"
msgstr "Ninguna"
-#: src/app/main/ui/settings/notifications.cljs:68
+#: src/app/main/ui/settings/notifications.cljs:70
msgid "dashboard.settings.notifications.email-comments.partial"
msgstr "Sólo menciones y respuestas"
-#: src/app/main/ui/settings/notifications.cljs:64
+#: src/app/main/ui/settings/notifications.cljs:66
msgid "dashboard.settings.notifications.email-comments.title"
msgstr "Comentarios de ficheros"
-#: src/app/main/ui/settings/notifications.cljs:76
+#: src/app/main/ui/settings/notifications.cljs:87
msgid "dashboard.settings.notifications.email-invites.all"
msgstr "Todas las invitaciones y solicitudes"
-#: src/app/main/ui/settings/notifications.cljs:79
+#: src/app/main/ui/settings/notifications.cljs:90
msgid "dashboard.settings.notifications.email-invites.none"
msgstr "Ninguna"
-#: src/app/main/ui/settings/notifications.cljs:73
+#: src/app/main/ui/settings/notifications.cljs:84
msgid "dashboard.settings.notifications.email-invites.title"
msgstr "Invitaciones y solicitudes"
-#: src/app/main/ui/settings/notifications.cljs:63
+#: src/app/main/ui/settings/notifications.cljs:78
+msgid "dashboard.settings.notifications.email-tasks.all"
+msgstr "Todas las tareas"
+
+#: src/app/main/ui/settings/notifications.cljs:80
+msgid "dashboard.settings.notifications.email-tasks.none"
+msgstr "Ninguna"
+
+#: src/app/main/ui/settings/notifications.cljs:79
+msgid "dashboard.settings.notifications.email-tasks.partial"
+msgstr "Sólo las tareas que he creado o que tengo asignadas"
+
+#: src/app/main/ui/settings/notifications.cljs:75
+msgid "dashboard.settings.notifications.email-tasks.title"
+msgstr "Tareas"
+
+#: src/app/main/ui/settings/notifications.cljs:65
msgid "dashboard.settings.notifications.email.title"
msgstr "Notificaciones de correo electrónico"
-#: src/app/main/ui/settings/notifications.cljs:84
+#: src/app/main/ui/settings/notifications.cljs:95
msgid "dashboard.settings.notifications.submit"
msgstr "Actualizar configuración"
-#: src/app/main/ui/settings/notifications.cljs:52
+#: src/app/main/ui/settings/notifications.cljs:54
msgid "dashboard.settings.notifications.title"
msgstr "Notificaciones"