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.
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import { trayEntryVisible } from '/client/lib/notificationTray';
|
|
|
|
// this hides the notifications drawer if anyone clicks off of the panel
|
|
Template.body.events({
|
|
click(event) {
|
|
if (
|
|
!$(event.target).is('#notifications *') &&
|
|
Session.get('showNotificationsDrawer')
|
|
) {
|
|
toggleNotificationsDrawer();
|
|
}
|
|
},
|
|
});
|
|
|
|
Template.notifications.helpers({
|
|
unreadNotifications() {
|
|
// Activity details are subscribed only while the drawer is open. The bell
|
|
// must count the user's unread records before that subscription exists.
|
|
const notifications = ReactiveCache.getCurrentUser()?.profile?.notifications || [];
|
|
// #5171: an entry scheduled for later is not counted until it shows.
|
|
const unreadNotifications = notifications.filter(v => !v.read && trayEntryVisible(v));
|
|
return unreadNotifications.length;
|
|
},
|
|
});
|
|
|
|
Template.notifications.events({
|
|
'click .notifications-drawer-toggle'() {
|
|
toggleNotificationsDrawer();
|
|
},
|
|
});
|
|
|
|
export function toggleNotificationsDrawer() {
|
|
Session.set(
|
|
'showNotificationsDrawer',
|
|
!Session.get('showNotificationsDrawer'),
|
|
);
|
|
}
|