mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 10:30:49 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -107,11 +107,11 @@
|
||||
"nodebb-plugin-spam-be-gone": "2.3.2",
|
||||
"nodebb-plugin-web-push": "0.7.6",
|
||||
"nodebb-rewards-essentials": "1.0.2",
|
||||
"nodebb-theme-harmony": "2.2.44",
|
||||
"nodebb-theme-harmony": "2.2.45",
|
||||
"nodebb-theme-lavender": "7.1.21",
|
||||
"nodebb-theme-peace": "2.2.56",
|
||||
"nodebb-theme-persona": "14.2.21",
|
||||
"nodebb-widget-essentials": "7.0.42",
|
||||
"nodebb-theme-persona": "14.2.22",
|
||||
"nodebb-widget-essentials": "7.0.43",
|
||||
"nodemailer": "8.0.1",
|
||||
"nprogress": "0.2.0",
|
||||
"passport": "0.7.0",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"invalid-data": "Invalid Data",
|
||||
"invalid-config-field-value": "Invalid value for config field \"%1\": %2",
|
||||
"invalid-json": "Invalid JSON",
|
||||
"wrong-parameter-type": "A value of type %3 was expected for property `%1`, but %2 was received instead",
|
||||
"required-parameters-missing": "Required parameters were missing from this API call: %1",
|
||||
|
||||
@@ -104,7 +104,7 @@ define('admin/settings', [
|
||||
if (err) {
|
||||
return alerts.alert({
|
||||
alert_id: 'config_status',
|
||||
timeout: 2500,
|
||||
timeout: 5000,
|
||||
title: '[[admin/admin:changes-not-saved]]',
|
||||
message: `[[admin/admin:changes-not-saved-message, ${err.message}]]`,
|
||||
type: 'danger',
|
||||
|
||||
@@ -110,7 +110,7 @@ define('forum/chats/messages', [
|
||||
|
||||
messages.scrollToBottomAfterImageLoad(chatContentEl);
|
||||
const $composer = chatContentEl.siblings('[component="chat/composer"]');
|
||||
if ($composer.length) {
|
||||
if ($composer.length && ajaxify.data?.template?.chats) {
|
||||
$composer[0].scrollIntoView(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ define('settings', ['hooks', 'alerts'], function (hooks, alerts) {
|
||||
title: '[[admin/admin:changes-not-saved]]',
|
||||
message: `[[admin/admin:changes-not-saved-message, ${err.message}]]`,
|
||||
type: 'error',
|
||||
timeout: 2500,
|
||||
timeout: 5000,
|
||||
});
|
||||
} else {
|
||||
const saveBtn = document.getElementById('save');
|
||||
|
||||
@@ -332,7 +332,7 @@ const utils = {
|
||||
},
|
||||
|
||||
isEmailValid: function (email) {
|
||||
return typeof email === 'string' && email.length && email.indexOf('@') !== -1 && email.indexOf(',') === -1 && email.indexOf(';') === -1;
|
||||
return typeof email === 'string' && email.length && email.includes('@') && !email.includes(',') && !email.includes(';');
|
||||
},
|
||||
|
||||
isUserNameValid: function (name) {
|
||||
|
||||
@@ -511,9 +511,10 @@ helpers.formatApiResponse = async (statusCode, res, payload) => {
|
||||
returnPayload.response = response;
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
returnPayload.stack = payload.stack;
|
||||
const stack = payload instanceof Error ? payload.stack : new Error(String(payload)).stack;
|
||||
returnPayload.stack = stack;
|
||||
process.stdout.write(`[${chalk.yellow('api')}] Exception caught, error with stack trace follows:\n`);
|
||||
process.stdout.write(payload.stack);
|
||||
process.stdout.write(stack);
|
||||
}
|
||||
res.status(statusCode).json(returnPayload);
|
||||
} else {
|
||||
|
||||
@@ -8,6 +8,7 @@ const winston = require('winston');
|
||||
const db = require('../database');
|
||||
const pubsub = require('../pubsub');
|
||||
const Meta = require('./index');
|
||||
const translator = require('../translator');
|
||||
const cacheBuster = require('./cacheBuster');
|
||||
const defaults = require('../../install/data/defaults.json');
|
||||
|
||||
@@ -190,7 +191,9 @@ function ensureInteger(data, field, min) {
|
||||
if (data.hasOwnProperty(field)) {
|
||||
data[field] = parseInt(data[field], 10);
|
||||
if (!(data[field] >= min)) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
throw new Error(translator.compile(
|
||||
'error:invalid-config-field-value', field, data[field]
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,14 +308,20 @@ middleware.validateAuth = helpers.try(async (req, res, next) => {
|
||||
});
|
||||
|
||||
middleware.checkRequired = function (fields, req, res, next) {
|
||||
const body = req.body || {};
|
||||
const query = req.query || {};
|
||||
// Used in API calls to ensure that necessary parameters/data values are present
|
||||
const missing = fields.filter(
|
||||
field => req.body && !req.body.hasOwnProperty(field) && !req.query.hasOwnProperty(field)
|
||||
field => !body.hasOwnProperty(field) && !query.hasOwnProperty(field)
|
||||
);
|
||||
|
||||
if (!missing.length) {
|
||||
return next();
|
||||
}
|
||||
|
||||
controllers.helpers.formatApiResponse(400, res, new Error(`[[error:required-parameters-missing, ${missing.join(' ')}]]`));
|
||||
controllers.helpers.formatApiResponse(
|
||||
400,
|
||||
res,
|
||||
new Error(`[[error:required-parameters-missing, ${missing.join(' ')}]]`)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -20,16 +20,17 @@ module.exports = function (Topics) {
|
||||
]);
|
||||
await Promise.all([
|
||||
db.sortedSetRemove(`cid:${cid}:pids`, pids),
|
||||
resolveTopicPostFlags(pids, uid),
|
||||
Topics.setTopicFields(tid, {
|
||||
deleted: 1,
|
||||
deleterUid: uid,
|
||||
deletedTimestamp: Date.now(),
|
||||
}),
|
||||
activitypub.out.remove.context(uid, tid),
|
||||
]);
|
||||
|
||||
await categories.updateRecentTidForCid(cid);
|
||||
await Promise.all([
|
||||
resolveTopicPostFlags(pids, uid),
|
||||
activitypub.out.remove.context(uid, tid),
|
||||
categories.updateRecentTidForCid(cid),
|
||||
]);
|
||||
};
|
||||
|
||||
async function resolveTopicPostFlags(pids, uid) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</div>
|
||||
|
||||
<div class="col-10 offset-1 col-md-4 offset-4 d-flex flex-column gap-3">
|
||||
<a href="{outgoing}" rel="nofollow noopener noreferrer" class="btn btn-primary">[[notifications:continue-to, {outgoing}]]</a>
|
||||
<a href="{outgoing}" rel="nofollow noopener noreferrer" class="btn btn-primary text-break">[[notifications:continue-to, {outgoing}]]</a>
|
||||
<a href="#" class="btn btn-link" onclick="history.back(); return false;">[[notifications:return-to, {title}]]</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user