feat: allow disabling of GDPR features via ACP toggle, closes #6847

This commit is contained in:
Julian Lam
2018-10-26 15:20:57 -04:00
parent 51792da430
commit 4919e9efa3
6 changed files with 52 additions and 27 deletions

View File

@@ -51,32 +51,32 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
user.getIPs(uid, 4, next);
},
profile_menu: function (next) {
plugins.fireHook('filter:user.profileMenu', {
uid: uid,
callerUID: callerUID,
links: [{
id: 'info',
route: 'info',
name: '[[user:account_info]]',
visibility: {
self: false,
other: false,
moderator: true,
globalMod: true,
admin: true,
},
}, {
id: 'sessions',
route: 'sessions',
name: '[[pages:account/sessions]]',
visibility: {
self: true,
other: false,
moderator: false,
globalMod: false,
admin: false,
},
}, {
const links = [{
id: 'info',
route: 'info',
name: '[[user:account_info]]',
visibility: {
self: false,
other: false,
moderator: true,
globalMod: true,
admin: true,
},
}, {
id: 'sessions',
route: 'sessions',
name: '[[pages:account/sessions]]',
visibility: {
self: true,
other: false,
moderator: false,
globalMod: false,
admin: false,
},
}];
if (meta.config.gdpr_enabled) {
links.push({
id: 'consent',
route: 'consent',
name: '[[user:consent.title]]',
@@ -87,7 +87,13 @@ helpers.getUserDataByUserSlug = function (userslug, callerUID, callback) {
globalMod: false,
admin: false,
},
}],
});
}
plugins.fireHook('filter:user.profileMenu', {
uid: uid,
callerUID: callerUID,
links: links,
}, next);
},
groups: function (next) {