mirror of
https://github.com/wekan/wekan.git
synced 2026-11-08 11:25:19 -05:00
New Notifications category with three GDPR toggles (all default off), enforced server-side: - Disable all activities: activity-feed entries are neither recorded (Activities.before.insert returns false to cancel) nor shown (the activities publication returns nothing, hiding existing and new entries). - Disable all notifications: the Activities.after.insert dispatch hook returns early, so no watch notifications are sent; activity recording is unaffected. - Disable watch: the watch() method rejects any watch-level change, and the board header watch button is hidden. A synchronously-readable server cache (models/lib/featureFlags.js, kept current by a Settings observer) lets the sync before.insert hook read the flags without awaiting. Adds settings disableActivities, disableNotifications, disableWatch, published in the public setting, plus global Blaze helpers activitiesDisabled / watchDisabled for UI hiding.
104 lines
2.5 KiB
JavaScript
104 lines
2.5 KiB
JavaScript
import { ReactiveCache } from '/imports/reactiveCache';
|
|
import Settings from '/models/settings';
|
|
import Integrations from '/models/integrations';
|
|
|
|
Meteor.publish('globalwebhooks', async function() {
|
|
if (!this.userId) {
|
|
return this.ready();
|
|
}
|
|
|
|
const user = await ReactiveCache.getCurrentUser();
|
|
if (!user || !user.isAdmin) {
|
|
return this.ready();
|
|
}
|
|
|
|
const boardId = Integrations.Const.GLOBAL_WEBHOOK_ID;
|
|
const ret = await ReactiveCache.getIntegrations(
|
|
{
|
|
boardId,
|
|
},
|
|
{
|
|
fields: {
|
|
token: 0,
|
|
},
|
|
},
|
|
true,
|
|
);
|
|
return ret;
|
|
});
|
|
Meteor.publish('setting', () => {
|
|
const ret = Settings.find(
|
|
{},
|
|
{
|
|
fields: {
|
|
disableRegistration: 1,
|
|
disableForgotPassword: 1,
|
|
renderLinksAsPlainText: 1,
|
|
alwaysShowCodeAsText: 1,
|
|
disableActivities: 1,
|
|
disableNotifications: 1,
|
|
disableWatch: 1,
|
|
disableAllExport: 1,
|
|
disableAllImport: 1,
|
|
disableExportAvatars: 1,
|
|
disableImportAvatars: 1,
|
|
anonymizeExportUsers: 1,
|
|
anonymizeImportUsers: 1,
|
|
productName: 1,
|
|
hideLogo: 1,
|
|
hideCardCounterList: 1,
|
|
hideBoardMemberList: 1,
|
|
cardsLoading: 1,
|
|
customLoginLogoImageUrl: 1,
|
|
customLoginLogoLinkUrl: 1,
|
|
customHelpLinkUrl: 1,
|
|
textBelowCustomLoginLogo: 1,
|
|
automaticLinkedUrlSchemes: 1,
|
|
customTopLeftCornerLogoImageUrl: 1,
|
|
customTopLeftCornerLogoLinkUrl: 1,
|
|
customTopLeftCornerLogoHeight: 1,
|
|
customHTMLafterBodyStart: 1,
|
|
customHTMLbeforeBodyEnd: 1,
|
|
displayAuthenticationMethod: 1,
|
|
defaultAuthenticationMethod: 1,
|
|
spinnerName: 1,
|
|
oidcBtnText: 1,
|
|
mailDomainName: 1,
|
|
legalNotice: 1,
|
|
customHeadEnabled: 1,
|
|
customHeadMetaTags: 1,
|
|
customHeadLinkTags: 1,
|
|
customManifestEnabled: 1,
|
|
customManifestContent: 1,
|
|
customAssetLinksEnabled: 1,
|
|
customAssetLinksContent: 1,
|
|
accessibilityPageEnabled: 1,
|
|
accessibilityTitle: 1,
|
|
accessibilityContent: 1,
|
|
},
|
|
},
|
|
);
|
|
return ret;
|
|
});
|
|
|
|
Meteor.publish('mailServer', async function() {
|
|
const user = await ReactiveCache.getCurrentUser();
|
|
|
|
let ret = []
|
|
if (user && user.isAdmin) {
|
|
ret = Settings.find(
|
|
{},
|
|
{
|
|
fields: {
|
|
'mailServer.host': 1,
|
|
'mailServer.port': 1,
|
|
'mailServer.username': 1,
|
|
'mailServer.enableTLS': 1,
|
|
'mailServer.from': 1,
|
|
},
|
|
},
|
|
);
|
|
}
|
|
return ret;
|
|
});
|