fix: use escaped group names in invite modal

isekai-main
Barış Soner Uşaklı 3 years ago
parent e1e1d5223e
commit 2a89ad8288

@ -200,7 +200,7 @@ Users.invite = async (req, res) => {
return helpers.formatApiResponse(403, res, new Error('[[error:no-privileges]]'));
}
const inviteGroups = await groups.getUserInviteGroups(req.uid);
const inviteGroups = (await groups.getUserInviteGroups(req.uid)).map(group => group.name);
const cannotInvite = groupsToJoin.some(group => !inviteGroups.includes(group));
if (groupsToJoin.length > 0 && cannotInvite) {
return helpers.formatApiResponse(403, res, new Error('[[error:no-privileges]]'));
@ -231,7 +231,7 @@ Users.getInviteGroups = async function (req, res) {
}
const userInviteGroups = await groups.getUserInviteGroups(req.params.uid);
return helpers.formatApiResponse(200, res, userInviteGroups);
return helpers.formatApiResponse(200, res, userInviteGroups.map(group => group.displayName));
};
Users.listEmails = async (req, res) => {

@ -37,7 +37,10 @@ module.exports = function (Groups) {
allGroups = allGroups.filter(group => !Groups.ephemeralGroups.includes(group.name));
const publicGroups = allGroups.filter(group => group.hidden === 0 && group.system === 0 && group.private === 0);
const adminModGroups = [{ name: 'administrators' }, { name: 'Global Moderators' }];
const adminModGroups = [
{ name: 'administrators', displayName: 'administrators' },
{ name: 'Global Moderators', displayName: 'Global Moderators' },
];
// Private (but not hidden)
const privateGroups = allGroups.filter(group => group.hidden === 0 && group.system === 0 && group.private === 1);
@ -58,7 +61,6 @@ module.exports = function (Groups) {
}
return inviteGroups
.concat(publicGroups)
.map(group => group.name);
.concat(publicGroups);
};
};

Loading…
Cancel
Save