mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-27 09:49:52 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -132,6 +132,7 @@ Configs.setMultiple = async function (data) {
|
||||
await processConfig(data);
|
||||
data = serialize(data);
|
||||
await db.setObject('config', data);
|
||||
await updateNavItems(data);
|
||||
updateConfig(deserialize(data));
|
||||
};
|
||||
|
||||
@@ -228,6 +229,13 @@ async function getLogoSize(data) {
|
||||
data['brand:emailLogo:width'] = size.width;
|
||||
}
|
||||
|
||||
async function updateNavItems(data) {
|
||||
if (data.hasOwnProperty('activitypubEnabled')) {
|
||||
const navAdmin = require('../navigation/admin');
|
||||
await navAdmin.update('/world', { enabled: data.activitypubEnabled ? 'on' : '' });
|
||||
}
|
||||
}
|
||||
|
||||
function updateConfig(config) {
|
||||
updateLocalConfig(config);
|
||||
pubsub.publish('config:update', config);
|
||||
|
||||
@@ -85,6 +85,19 @@ admin.get = async function () {
|
||||
return cache.map(item => ({ ...item }));
|
||||
};
|
||||
|
||||
admin.update = async function (route, data) {
|
||||
const ids = await db.getSortedSetRange('navigation:enabled', 0, -1);
|
||||
const navItems = await db.getObjects(ids.map(id => `navigation:enabled:${id}`));
|
||||
const matchedRoutes = navItems.filter(item => item && item.route === route);
|
||||
if (matchedRoutes.length) {
|
||||
await db.setObjectBulk(
|
||||
matchedRoutes.map(item => [`navigation:enabled:${item.order}`, data])
|
||||
);
|
||||
cache = null;
|
||||
pubsub.publish('admin:navigation:save');
|
||||
}
|
||||
};
|
||||
|
||||
async function getAvailable() {
|
||||
const core = require('../../install/data/navigation.json').map((item) => {
|
||||
item.core = true;
|
||||
|
||||
@@ -124,23 +124,22 @@ UserEmail.sendValidationEmail = async function (uid, options) {
|
||||
};
|
||||
}
|
||||
|
||||
const confirm_code = utils.generateUUID();
|
||||
const confirm_link = `${nconf.get('url')}/confirm/${confirm_code}`;
|
||||
|
||||
const { emailConfirmInterval, emailConfirmExpiry } = meta.config;
|
||||
|
||||
// If no email passed in (default), retrieve email from uid
|
||||
if (!options.email || !options.email.length) {
|
||||
options.email = await user.getUserField(uid, 'email');
|
||||
}
|
||||
if (!options.email) {
|
||||
winston.warn(`[user/email] No email found for uid ${uid}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const { emailConfirmInterval, emailConfirmExpiry } = meta.config;
|
||||
if (!options.force && !await UserEmail.canSendValidation(uid, options.email)) {
|
||||
throw new Error(`[[error:confirm-email-already-sent, ${emailConfirmInterval}]]`);
|
||||
}
|
||||
|
||||
const confirm_code = utils.generateUUID();
|
||||
const confirm_link = `${nconf.get('url')}/confirm/${confirm_code}`;
|
||||
const username = await user.getUserField(uid, 'username');
|
||||
const data = await plugins.hooks.fire('filter:user.verify', {
|
||||
uid,
|
||||
|
||||
Reference in New Issue
Block a user