mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
One delivery model (models/lib/notificationDelivery.js) for every channel - e-mail, the notification tray and outgoing webhooks - set in the Notifications popup at Admin Panel, board and Member Settings scope, and in each one-way webhook's form: - Content. Webhooks: the text on or off, and which property groups are sent (standard, ids, names, links, actor, people, details), with checklist, list, swimlane and board names, before/after values, the card description and links added as opt-in groups. E-mail and tray: the classic sentence or a clear layout - the board as a link first, the actor and card in bold - and which parts are shown. - Grouping: one message per event, per card, per board, or all together. - Scheduling: immediately, every 5 minutes to 24 hours, or once a day, with optional quiet hours, in the time zone of whoever set it. The most specific explicit setting wins: member, then board, then Admin Panel for e-mail and tray; the webhook, then its board, then Admin Panel for webhooks. A member can only leave their own name out of outgoing webhooks. The built-in defaults keep today's behaviour. Grouped and scheduled webhooks and e-mail go through durable queues that survive restarts; queued webhooks use the SSRF guard and log a blocked address in Admin Panel - Problems. Values of admin-only custom fields now reach only board admins in e-mail and tray, and never a webhook. The new strings are in English in every locale, pending Transifex. Thanks to HaKePlan, Meeques and xet7 ! Fixes #3695, Fixes #5171.
85 lines
4.4 KiB
Plaintext
85 lines
4.4 KiB
Plaintext
//- #3695 / #5171: how one notification channel delivers - content, grouping
|
|
//- and schedule (models/lib/notificationDelivery.js). One template for every
|
|
//- place it is set:
|
|
//- scope 'admin' Admin Panel / Notifications - instance defaults
|
|
//- scope 'board' Board Settings / Notifications - this board
|
|
//- scope 'member' Member Settings / Notifications - the member's own
|
|
//- e-mail and tray; for webhooks only "leave my name out"
|
|
//- scope 'integration' one webhook's own form (targetId = its _id)
|
|
//- channel is 'email' | 'tray' | 'webhook'. Every change saves at once through
|
|
//- the setNotificationDelivery method, which checks the caller's role and
|
|
//- validates the value. "Default" inherits the next level.
|
|
template(name="notificationDeliverySettings")
|
|
details.notification-delivery-settings(data-scope="{{scope}}" data-channel="{{channel}}")
|
|
summary.title
|
|
i.fa(class="{{channelIcon}}")
|
|
| {{_ channelLabel}}
|
|
if memberWebhook
|
|
a.flex.js-webhook-hide-identity(role="checkbox" aria-checked="{{#if hideIdentity}}true{{else}}false{{/if}}")
|
|
.materialCheckBox(class="{{#if hideIdentity}}is-checked{{/if}}")
|
|
span {{_ 'webhook-hide-identity'}}
|
|
else
|
|
if isWebhook
|
|
p.quiet {{_ 'webhook-payload-description'}}
|
|
label.notification-delivery-label
|
|
| {{_ 'webhook-payload-text'}}
|
|
select.js-delivery-select(data-key="text")
|
|
each textOptions
|
|
option(value=value selected=selected) {{_ labelKey}}
|
|
p.notification-delivery-label {{_ 'webhook-payload-fields'}}
|
|
+notificationDeliveryChecklist(rows=fieldRows key="fields" inherit=fieldsInherit offerDefault=offerDefault)
|
|
else
|
|
label.notification-delivery-label
|
|
| {{_ 'notification-delivery-layout'}}
|
|
select.js-delivery-select(data-key="layout")
|
|
each layoutOptions
|
|
option(value=value selected=selected) {{_ labelKey}}
|
|
if showParts
|
|
p.notification-delivery-label {{_ 'notification-delivery-parts'}}
|
|
+notificationDeliveryChecklist(rows=partRows key="parts" inherit=partsInherit offerDefault=offerDefault)
|
|
label.notification-delivery-label
|
|
| {{_ 'notification-delivery-grouping'}}
|
|
select.js-delivery-select(data-key="grouping")
|
|
each groupingOptions
|
|
option(value=value selected=selected) {{_ labelKey}}
|
|
label.notification-delivery-label
|
|
| {{_ 'notification-delivery-schedule'}}
|
|
select.js-delivery-select(data-key="schedule")
|
|
each scheduleOptions
|
|
option(value=value selected=selected) {{_ labelKey}}
|
|
if scheduleIs 'interval'
|
|
label.notification-delivery-label
|
|
| {{_ 'notification-delivery-interval'}}
|
|
select.js-delivery-select(data-key="intervalMinutes")
|
|
each intervalOptions
|
|
option(value=value selected=selected) {{label}}
|
|
if scheduleIs 'daily'
|
|
label.notification-delivery-label
|
|
| {{_ 'notification-delivery-daily-time'}}
|
|
input.js-delivery-time(type="time" data-key="dailyTime" value=dailyTime)
|
|
p.notification-delivery-label {{_ 'notification-delivery-quiet'}}
|
|
.notification-delivery-quiet
|
|
label
|
|
| {{_ 'notification-delivery-quiet-from'}}
|
|
input.js-delivery-quiet(type="time" data-key="quietStart" value=quietStart)
|
|
label
|
|
| {{_ 'notification-delivery-quiet-to'}}
|
|
input.js-delivery-quiet(type="time" data-key="quietEnd" value=quietEnd)
|
|
if hasQuiet
|
|
a.js-delivery-quiet-clear {{_ 'notification-delivery-quiet-clear'}}
|
|
if timezone
|
|
p.quiet.notification-delivery-timezone {{_ 'notification-delivery-timezone'}} {{timezone}}
|
|
if message
|
|
p.quiet.js-delivery-message {{message}}
|
|
|
|
template(name="notificationDeliveryChecklist")
|
|
.notification-delivery-checklist(data-key="{{key}}")
|
|
if offerDefault
|
|
a.flex.js-delivery-list-default(data-key="{{key}}" role="checkbox" aria-checked="{{#if inherit}}true{{else}}false{{/if}}")
|
|
.materialCheckBox(class="{{#if inherit}}is-checked{{/if}}")
|
|
span {{_ 'default'}}
|
|
each rows
|
|
a.flex.js-delivery-list-item(data-key="{{../key}}" data-value="{{value}}" role="checkbox" aria-checked="{{#if enabled}}true{{else}}false{{/if}}")
|
|
.materialCheckBox(class="{{#if enabled}}is-checked{{/if}}")
|
|
span {{_ labelKey}}
|