fix: spec

v1.18.x
Barış Soner Uşaklı 4 years ago
parent e9585b9be2
commit 8d060065a0

@ -14,6 +14,9 @@ GroupFullObject:
userTitle: userTitle:
type: number type: number
description: Label text for the user badge description: Label text for the user badge
userTitleEscaped:
type: number
description: Same as userTitle but with translation tokens escaped, used to display raw userTitle in group management
userTitleEnabled: userTitleEnabled:
type: number type: number
description: description:
@ -122,6 +125,9 @@ GroupDataObject:
userTitle: userTitle:
type: number type: number
description: Label text for the user badge description: Label text for the user badge
userTitleEscaped:
type: number
description: Same as userTitle but with translation tokens escaped, used to display raw userTitle in group management
userTitleEnabled: userTitleEnabled:
type: number type: number
description: description:

@ -30,6 +30,8 @@ get:
type: number type: number
userTitle: userTitle:
type: string type: string
userTitleEscaped:
type: string
icon: icon:
type: string type: string
labelColor: labelColor:

@ -26,6 +26,8 @@ get:
type: number type: number
userTitle: userTitle:
type: string type: string
userTitleEscaped:
type: string
icon: icon:
type: string type: string
labelColor: labelColor:

@ -10,7 +10,6 @@ const groups = require('../../groups');
const meta = require('../../meta'); const meta = require('../../meta');
const pagination = require('../../pagination'); const pagination = require('../../pagination');
const events = require('../../events'); const events = require('../../events');
const translator = require('../../translator');
const groupsController = module.exports; const groupsController = module.exports;
@ -46,7 +45,7 @@ groupsController.get = async function (req, res, next) {
return next(); return next();
} }
group.isOwner = true; group.isOwner = true;
group.userTitleEscaped = translator.escape(group.userTitle);
const groupNameData = groupNames.map(function (name) { const groupNameData = groupNames.map(function (name) {
return { return {
encodedName: encodeURIComponent(name), encodedName: encodeURIComponent(name),

@ -9,7 +9,6 @@ const user = require('../user');
const helpers = require('./helpers'); const helpers = require('./helpers');
const pagination = require('../pagination'); const pagination = require('../pagination');
const privileges = require('../privileges'); const privileges = require('../privileges');
const translator = require('../translator');
const groupsController = module.exports; const groupsController = module.exports;
@ -73,7 +72,7 @@ groupsController.details = async function (req, res, next) {
return next(); return next();
} }
groupData.isOwner = groupData.isOwner || isAdmin || (isGlobalMod && !groupData.system); groupData.isOwner = groupData.isOwner || isAdmin || (isGlobalMod && !groupData.system);
groupData.userTitleEscaped = translator.escape(groupData.userTitle);
res.render('groups/details', { res.render('groups/details', {
title: '[[pages:group, ' + groupData.displayName + ']]', title: '[[pages:group, ' + groupData.displayName + ']]',
group: groupData, group: groupData,

@ -6,6 +6,7 @@ const nconf = require('nconf');
const db = require('../database'); const db = require('../database');
const plugins = require('../plugins'); const plugins = require('../plugins');
const utils = require('../utils'); const utils = require('../utils');
const translator = require('../translator');
const intFields = [ const intFields = [
'createtime', 'memberCount', 'hidden', 'system', 'private', 'createtime', 'memberCount', 'hidden', 'system', 'private',
@ -101,5 +102,6 @@ function escapeGroupData(group) {
group.displayName = validator.escape(String(group.name)); group.displayName = validator.escape(String(group.name));
group.description = validator.escape(String(group.description || '')); group.description = validator.escape(String(group.description || ''));
group.userTitle = validator.escape(String(group.userTitle || '')); group.userTitle = validator.escape(String(group.userTitle || ''));
group.userTitleEscaped = translator.escape(group.userTitle);
} }
} }

Loading…
Cancel
Save