mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 16:41:21 +01:00
Merge branch 'master' into develop
This commit is contained in:
@@ -225,7 +225,7 @@ define('forum/topic/threadTools', [
|
||||
return;
|
||||
}
|
||||
dropdownMenu.html(helpers.generatePlaceholderWave([8, 8, 8]));
|
||||
const data = await socket.emit('topics.loadTopicTools', { tid: ajaxify.data.tid, cid: ajaxify.data.cid });
|
||||
const data = await socket.emit('topics.loadTopicTools', { tid: ajaxify.data.tid, cid: ajaxify.data.cid }).catch(alerts.error);
|
||||
const html = await app.parseAndTranslate('partials/topic/topic-menu-list', data);
|
||||
$(dropdownMenu).attr('data-loaded', 'true').html(html);
|
||||
hooks.fire('action:topic.tools.load', {
|
||||
|
||||
@@ -150,6 +150,7 @@ module.exports = function (middleware) {
|
||||
async function loadClientHeaderFooterData(req, res, options) {
|
||||
const registrationType = meta.config.registrationType || 'normal';
|
||||
res.locals.config = res.locals.config || {};
|
||||
const userLang = res.locals.config.userLang || meta.config.userLang || 'en-GB';
|
||||
const templateValues = {
|
||||
title: meta.config.title || '',
|
||||
'title:url': meta.config['title:url'] || '',
|
||||
@@ -180,9 +181,9 @@ module.exports = function (middleware) {
|
||||
blocks: user.blocks.list(req.uid),
|
||||
user: user.getUserData(req.uid),
|
||||
isEmailConfirmSent: req.uid <= 0 ? false : await user.email.isValidationPending(req.uid),
|
||||
languageDirection: translator.translate('[[language:dir]]', res.locals.config.userLang),
|
||||
timeagoCode: languages.userTimeagoCode(res.locals.config.userLang),
|
||||
browserTitle: translator.translate(controllersHelpers.buildTitle(title)),
|
||||
languageDirection: translator.translate('[[language:dir]]', userLang),
|
||||
timeagoCode: languages.userTimeagoCode(userLang),
|
||||
browserTitle: translator.translate(controllersHelpers.buildTitle(title), userLang),
|
||||
navigation: navigation.get(req.uid),
|
||||
roomIds: req.uid > 0 ? db.getSortedSetRevRange(`uid:${req.uid}:chat:rooms`, 0, 0) : [],
|
||||
});
|
||||
|
||||
@@ -6,9 +6,6 @@ const plugins = require('../../plugins');
|
||||
|
||||
module.exports = function (SocketTopics) {
|
||||
SocketTopics.loadTopicTools = async function (socket, data) {
|
||||
if (!socket.uid) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
if (!data) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
@@ -21,7 +18,7 @@ module.exports = function (SocketTopics) {
|
||||
if (!topicData) {
|
||||
throw new Error('[[error:no-topic]]');
|
||||
}
|
||||
if (!userPrivileges['topics:read']) {
|
||||
if (!userPrivileges['topics:read'] || !userPrivileges.view_thread_tools) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
topicData.privileges = userPrivileges;
|
||||
|
||||
@@ -4,6 +4,7 @@ const assert = require('assert');
|
||||
const nconf = require('nconf');
|
||||
|
||||
const db = require('../mocks/databasemock');
|
||||
const request = require('../../src/request');
|
||||
const user = require('../../src/user');
|
||||
const topics = require('../../src/topics');
|
||||
const posts = require('../../src/posts');
|
||||
@@ -192,11 +193,12 @@ describe('Privilege logic for remote users/content (ActivityPub)', () => {
|
||||
|
||||
describe('groups:find', () => {
|
||||
it('should return webfinger response to a category\'s handle', async () => {
|
||||
const response = await activitypub.helpers.query(`${handle}@${nconf.get('url_parsed').hostname}`);
|
||||
const { response, body } = await request.get(`${nconf.get('url')}/.well-known/webfinger?resource=acct:${handle}@${nconf.get('url_parsed').host}`);
|
||||
|
||||
assert(response);
|
||||
assert.strictEqual(response.subject, `acct:${handle}@${nconf.get('url_parsed').hostname}`);
|
||||
assert.strictEqual(response.hostname, nconf.get('url_parsed').hostname);
|
||||
assert.strictEqual(response.statusCode, 200);
|
||||
assert(body.links && body.links.length);
|
||||
assert.strictEqual(body.subject, `acct:${handle}@${nconf.get('url_parsed').host}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user