Node.js based forum software built for the modern web
Merge branch 'master' into develop
Barış Soner Uşaklı734f51fbbb05
diff --cc install/package.jsonindex ac2a9ad080,f776958a7f..ee454133aa--- a/install/package.json+++ b/install/package.json@@@ -103,22 -102,22 +103,22 @@@"multer": "2.2.0","nconf": "0.13.0","nodebb-plugin-2factor": "8.0.5",- "nodebb-plugin-composer-default": "11.0.9",+ "nodebb-plugin-composer-default": "11.0.10","nodebb-plugin-dbsearch": "7.0.0",- "nodebb-plugin-emoji": "6.0.14",+ "nodebb-plugin-emoji": "6.0.16","nodebb-plugin-emoji-android": "4.1.1",- "nodebb-plugin-link-preview": "2.2.8",- "nodebb-plugin-markdown": "13.2.6",+ "nodebb-plugin-link-preview": "2.2.9",+ "nodebb-plugin-markdown": "13.2.7","nodebb-plugin-mentions": "5.0.2",- "nodebb-plugin-spam-be-gone": "2.3.4",- "nodebb-plugin-web-push": "0.8.1",+ "nodebb-plugin-spam-be-gone": "2.3.5",+ "nodebb-plugin-web-push": "0.9.2","nodebb-rewards-essentials": "1.0.3",- "nodebb-theme-harmony": "3.1.14",+ "nodebb-theme-harmony": "3.1.15",- "nodebb-theme-lavender": "8.0.6",- "nodebb-theme-peace": "3.0.6",+ "nodebb-theme-lavender": "8.1.0",+ "nodebb-theme-peace": "3.1.2",- "nodebb-theme-persona": "15.1.8",- "nodebb-widget-essentials": "8.0.8",+ "nodebb-theme-persona": "15.1.9",+ "nodebb-widget-essentials": "8.0.9",- "nodemailer": "9.0.3",+ "nodemailer": "9.0.5","nprogress": "0.2.0","passport": "0.7.0","passport-http-bearer": "1.0.1",diff --cc public/src/client/groups/details.jsindex 5bb0d20180,14b3dc973b..ac0dd61885--- a/public/src/client/groups/details.js+++ b/public/src/client/groups/details.js@@@ -85,8 -99,8 +99,8 @@@ define('forum/groups/details',switch (action) {case 'toggleOwnership':- api[isOwner ? 'del' : 'put'](`/groups/${ajaxify.data.group.slug}/ownership/${encodeURIComponent(uid)}`, {}).then(() => {+ memberList.toggleOwnership(ajaxify.data.group.slug, uid, isOwner).then(() => {- ownerFlagEl.toggleClass('invisible');+ ownerFlagEl.toggleClass('d-none');userRow.attr('data-isowner', isOwner ? '0' : '1');}).catch(alerts.error);break;diff --cc src/middleware/render.jsindex 7483df4ac2,ad9e988c1e..3b80500734--- a/src/middleware/render.js+++ b/src/middleware/render.js@@@ -282,13 -280,17 +280,17 @@@ module.exports = function (middleware)const version = nconf.get('version');- res.locals.config.userLang = res.locals.config.acpLang || res.locals.config.userLang;const langDirection = translator.languageDirection(res.locals.config.acpLang);res.locals.config.isRTL = langDirection === 'rtl';+ const config = {+ ...res.locals.config,+ // override so the config.userLang client side is the acpLang for the admin panel+ userLang: res.locals.config.acpLang || res.locals.config.userLang,+ };const templateValues = {- config: res.locals.config,- configJSON: jsesc(JSON.stringify(res.locals.config), { isScriptContext: true }),- relative_path: res.locals.config.relative_path,+ config: config,- configJSON: jsesc(translator.escape(JSON.stringify(config)), { isScriptContext: true }),++ configJSON: jsesc(JSON.stringify(config), { isScriptContext: true }),+ relative_path: config.relative_path,adminConfigJSON: encodeURIComponent(JSON.stringify(results.configs)),metaTags: results.tags.meta,linkTags: results.tags.link,@@@ -398,14 -400,18 +400,12 @@@return str;}- function getLang(req, res) {- let language = (res.locals.config && res.locals.config.userLang) || 'en-GB';- if (res.locals.renderHeaderType === 'admin') {- language = (res.locals.config && res.locals.config.acpLang) || 'en-GB';- }- return req.query.lang ? req.query.lang : language;+ async function getLang(req, res) {+ if (req.query.lang) return req.query.lang;+ const config = res.locals.config ?? await user.getSettings(req.uid);+ return res.locals.isAdminPage ? config.acpLang : config.userLang;}- async function translate(str, language) {- // TODO: remove once all tx tokens are migrated to tx("") helper- const translated = await translator.translate(str, language);- return translator.unescape(translated);- }-async function appendUnreadCounts({ uid, navigation, unreadData, query }) {const routes = navigation.map(nav => nav.route);const calls = {diff --cc src/socket.io/user.jsindex 0aaac424a0,2bb7a23c80..b148386208--- a/src/socket.io/user.js+++ b/src/socket.io/user.js@@@ -158,18 -158,12 +158,19 @@@ SocketUser.editModerationNote = async fif (!socket.uid || !data || !data.uid || !data.note || !data.id) {throw new Error('[[error:invalid-data]]');}- const notes = await user.getModerationNotesByIds(data.uid, [data.id]);- const existingNote = notes.find(n => n && n.id === data.id);- const existingNote = await db.getObject(`uid:${data.uid}:moderation:note:${data.id}`);-- if (!existingNote) {- throw new Error('[[error:invalid-data]]');++++ const [note] = await user.getModerationNotesByIds(data.uid, [data.id]);++ if (!note) {+ throw new Error('[[error:no-privileges]]');}- const isAuthor = socket.uid === existingNote.uid;- const editingSelfNote = String(existingNote.uid) === String(socket.uid);++ const isAuthor = String(socket.uid) === String(note.uid);+ const isAdmin = await user.isAdministrator(socket.uid);+ if (!isAdmin && !isAuthor) {+ throw new Error('[[error:no-privileges]]');+ }++const noteData = {- uid: existingNote.uid,++ uid: note.uid,note: data.note,timestamp: data.id,};diff --cc src/views/groups/details.tplindex 6774ee0791,ef63641153..cd48a5f291--- a/src/views/groups/details.tpl+++ b/src/views/groups/details.tpl@@@ -65,7 -65,11 +65,11 @@@</div><div class="tab-pane fade" id="groups-invited" role="tabpanel">- <h3 class="fw-semibold fs-5 mb-3">{{tx("groups:details.invited")}}</h3>+ <div class="d-flex align-items-center justify-content-between mb-3">- <h3 class="fw-semibold fs-5">[[groups:details.invited]]</h3>- <button component="groups/invite-members" class="btn btn-primary btn-sm" type="button">[[groups:invite-members]]</button>++ <h3 class="fw-semibold fs-5">{{tx("groups:details.invited")}}</h3>++ <button component="groups/invite-members" class="btn btn-primary btn-sm" type="button">{{tx("groups:invite-members")}}</button>+ </div>+<!-- IMPORT partials/groups/invited.tpl --></div>diff --cc src/views/login.tplindex 41148a76b0,ac3da6be61..c7a8bed25a--- a/src/views/login.tpl+++ b/src/views/login.tpl@@@ -5,7 -5,14 +5,14 @@@</div><div class="row login flex-fill"><div class="d-flex flex-column gap-2 {{{ if widgets.sidebar.length }}}col-lg-9 col-sm-12{{{ else }}}col-lg-12{{{ end }}}">+ {{{ if reauthNotice }}}+ <div class="d-flex justify-content-center">+ <div class="alert alert-warning" role="alert">- [[error:api.reauth-required]]++ {{tx("error:api.reauth-required")}}+ </div>+ </div>+ {{{ end }}}- <h2 class="tracking-tight fw-semibold text-center">[[global:login]]</h2>+ <h2 class="tracking-tight fw-semibold text-center">{{tx("global:login")}}</h2><div class="row justify-content-center gap-5">{{{ if allowLocalLogin }}}<div class="col-12 col-md-5 col-lg-3 px-md-0">diff --cc src/views/partials/groups/invited.tplindex 88ca7bec13,606a3b4a21..42f7ced2e8--- a/src/views/partials/groups/invited.tpl+++ b/src/views/partials/groups/invited.tpl@@@ -1,20 -1,5 +1,5 @@@- <label class="text-xs text-muted">{{tx("groups:invited.search")}}</label>- <div class="input-group mb-2">- <input class="form-control" type="text" component="groups/members/invite"/>- <span class="input-group-text search-button"><i class="fa fa-search"></i></span>- </div>-- <div class="mb-2">- <label class="text-xs text-muted">{{tx("groups:bulk-invite-instructions")}}</label>- <textarea class="form-control" component="groups/members/bulk-invite"></textarea>- </div>-- <div class="mb-2 clearfix">- <button type="button" class="btn btn-primary btn-sm float-end" component="groups/members/bulk-invite-button">{{tx("groups:bulk-invite")}}</button>- </div>-<div style="max-height: 500px; overflow: auto;">- <div component="groups/invited/alert" class="alert alert-info {{{ if group.invited.length }}}hidden{{{ end }}}">[[groups:invited.none]]</div>+ <div component="groups/invited/alert" class="alert alert-info {{{ if group.invited.length }}}hidden{{{ end }}}">{{tx("groups:invited.none")}}</div><table component="groups/invited" class="table table-hover"><tbody>{{{ each group.invited }}}