mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 07:20:27 +01:00
Compare commits
15 Commits
socket-not
...
v1.15.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8ca993aac | ||
|
|
2b29dfe8e7 | ||
|
|
2b586764e2 | ||
|
|
07f8ab4e70 | ||
|
|
c4e3d84b38 | ||
|
|
a815cfdfed | ||
|
|
8245015cee | ||
|
|
2d39868dc3 | ||
|
|
e0f77d1791 | ||
|
|
a2cb768ac0 | ||
|
|
c0d406ae68 | ||
|
|
7c73ec75c6 | ||
|
|
ce5c0ee6e7 | ||
|
|
6528e9e402 | ||
|
|
2790a3a3fe |
@@ -2,7 +2,7 @@
|
|||||||
"name": "nodebb",
|
"name": "nodebb",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"description": "NodeBB Forum",
|
"description": "NodeBB Forum",
|
||||||
"version": "1.15.4",
|
"version": "1.15.5",
|
||||||
"homepage": "http://www.nodebb.org",
|
"homepage": "http://www.nodebb.org",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -338,7 +338,13 @@ define('forum/topic/postTools', [
|
|||||||
function bookmarkPost(button, pid) {
|
function bookmarkPost(button, pid) {
|
||||||
var method = button.attr('data-bookmarked') === 'false' ? 'put' : 'del';
|
var method = button.attr('data-bookmarked') === 'false' ? 'put' : 'del';
|
||||||
|
|
||||||
api[method](`/posts/${pid}/bookmark`, undefined, undefined, 'default');
|
api[method](`/posts/${pid}/bookmark`, undefined, function (err) {
|
||||||
|
if (err) {
|
||||||
|
return app.alertError(err);
|
||||||
|
}
|
||||||
|
var type = method === 'put' ? 'bookmark' : 'unbookmark';
|
||||||
|
$(window).trigger('action:post.' + type, { pid: pid });
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,6 +435,7 @@ define('forum/topic/postTools', [
|
|||||||
$(window).trigger('action:composer.topic.new', {
|
$(window).trigger('action:composer.topic.new', {
|
||||||
cid: ajaxify.data.cid,
|
cid: ajaxify.data.cid,
|
||||||
body: body,
|
body: body,
|
||||||
|
fromStaleTopic: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,14 +58,22 @@ define('forum/topic/votes', [
|
|||||||
var currentState = post.find(className).length;
|
var currentState = post.find(className).length;
|
||||||
|
|
||||||
const method = currentState ? 'del' : 'put';
|
const method = currentState ? 'del' : 'put';
|
||||||
api[method](`/posts/${post.attr('data-pid')}/vote`, {
|
var pid = post.attr('data-pid');
|
||||||
|
api[method](`/posts/${pid}/vote`, {
|
||||||
delta: delta,
|
delta: delta,
|
||||||
}).catch((err) => {
|
}, function (err) {
|
||||||
app.alertError(err.message);
|
if (err) {
|
||||||
|
|
||||||
if (err.message === '[[error:not-logged-in]]') {
|
if (err.message === '[[error:not-logged-in]]') {
|
||||||
ajaxify.go('login');
|
ajaxify.go('login');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
return app.alertError(err.message);
|
||||||
|
}
|
||||||
|
$(window).trigger('action:post.toggleVote', {
|
||||||
|
pid: pid,
|
||||||
|
delta: delta,
|
||||||
|
unvote: method === 'del',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ define('share', function () {
|
|||||||
|
|
||||||
function openShare(url, urlToPost, width, height) {
|
function openShare(url, urlToPost, width, height) {
|
||||||
window.open(url + encodeURIComponent(baseUrl + config.relative_path + urlToPost), '_blank', 'width=' + width + ',height=' + height + ',scrollbars=no,status=no');
|
window.open(url + encodeURIComponent(baseUrl + config.relative_path + urlToPost), '_blank', 'width=' + width + ',height=' + height + ',scrollbars=no,status=no');
|
||||||
|
$(window).trigger('action:share.open', {
|
||||||
|
url: url,
|
||||||
|
urlToPost: urlToPost,
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,8 @@ usersAPI.updateSettings = async function (caller, data) {
|
|||||||
throw new Error('[[error:no-privileges]]');
|
throw new Error('[[error:no-privileges]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
const current = await user.getSettings(data.uid);
|
// load raw settings without parsing values to booleans
|
||||||
|
const current = await db.getObject('user:' + data.uid + ':settings');
|
||||||
const payload = { ...current, ...data.settings };
|
const payload = { ...current, ...data.settings };
|
||||||
delete payload.uid;
|
delete payload.uid;
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ usersController.search = async function (req, res) {
|
|||||||
if (!query || query.length < 2) {
|
if (!query || query.length < 2) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
hardCap = hardCap || resultsPerPage * 10;
|
query = String(query).toLowerCase();
|
||||||
if (!query.endsWith('*')) {
|
if (!query.endsWith('*')) {
|
||||||
query += '*';
|
query += '*';
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ usersController.search = async function (req, res) {
|
|||||||
const data = await db.getSortedSetScan({
|
const data = await db.getSortedSetScan({
|
||||||
key: searchBy + ':sorted',
|
key: searchBy + ':sorted',
|
||||||
match: query,
|
match: query,
|
||||||
limit: hardCap,
|
limit: hardCap || (resultsPerPage * 10),
|
||||||
});
|
});
|
||||||
return data.map(data => data.split(':').pop());
|
return data.map(data => data.split(':').pop());
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -145,24 +145,31 @@ helpers.notAllowed = async function (req, res, error) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
helpers.redirect = function (res, url, permanent) {
|
helpers.redirect = function (res, url, permanent) {
|
||||||
let redirectUrl;
|
|
||||||
// this is used by sso plugins to redirect to the auth route
|
// this is used by sso plugins to redirect to the auth route
|
||||||
|
// { external: '/auth/sso' } or { external: 'https://domain/auth/sso' }
|
||||||
if (url.hasOwnProperty('external')) {
|
if (url.hasOwnProperty('external')) {
|
||||||
redirectUrl = url.external;
|
const redirectUrl = encodeURI(prependRelativePath(url.external));
|
||||||
url.external = encodeURI(url.external);
|
|
||||||
} else {
|
|
||||||
redirectUrl = url;
|
|
||||||
url = encodeURI(url);
|
|
||||||
}
|
|
||||||
if (res.locals.isAPI) {
|
if (res.locals.isAPI) {
|
||||||
res.set('X-Redirect', encodeURI(redirectUrl)).status(200).json(url);
|
res.set('X-Redirect', redirectUrl).status(200).json({ external: redirectUrl });
|
||||||
} else {
|
} else {
|
||||||
redirectUrl = redirectUrl.startsWith('http://') || redirectUrl.startsWith('https://') ?
|
res.redirect(permanent ? 308 : 307, redirectUrl);
|
||||||
redirectUrl : relative_path + redirectUrl;
|
}
|
||||||
res.redirect(permanent ? 308 : 307, encodeURI(redirectUrl));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.locals.isAPI) {
|
||||||
|
url = encodeURI(url);
|
||||||
|
res.set('X-Redirect', url).status(200).json(url);
|
||||||
|
} else {
|
||||||
|
res.redirect(permanent ? 308 : 307, encodeURI(prependRelativePath(url)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function prependRelativePath(url) {
|
||||||
|
return url.startsWith('http://') || url.startsWith('https://') ?
|
||||||
|
url : relative_path + url;
|
||||||
|
}
|
||||||
|
|
||||||
helpers.buildCategoryBreadcrumbs = async function (cid) {
|
helpers.buildCategoryBreadcrumbs = async function (cid) {
|
||||||
const breadcrumbs = [];
|
const breadcrumbs = [];
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,12 @@ middleware.checkPrivileges = helpers.try(async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If user does not have password
|
||||||
|
const hasPassword = await user.hasPassword(req.uid);
|
||||||
|
if (!hasPassword) {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
// Reject if they need to re-login (due to ACP timeout), otherwise extend logout timer
|
// Reject if they need to re-login (due to ACP timeout), otherwise extend logout timer
|
||||||
const loginTime = req.session.meta ? req.session.meta.datetime : 0;
|
const loginTime = req.session.meta ? req.session.meta.datetime : 0;
|
||||||
const adminReloginDuration = meta.config.adminReloginDuration * 60000;
|
const adminReloginDuration = meta.config.adminReloginDuration * 60000;
|
||||||
|
|||||||
Reference in New Issue
Block a user