fix(misc): correct one groups issue and two others

This commit is contained in:
SabreCat
2022-08-25 09:24:08 -05:00
parent 6aabf7b19a
commit 7129639bbf
3 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -84,7 +84,8 @@ export function canEdit (store) {
const user = store.state.user.data;
const userId = user.id || user._id;
const isUserAdmin = user.permissions && user.permissions.challengeAdmin;
const isUserAdmin = user.permissions
&& (user.permissions.challengeAdmin || user.permissions.fullAccess);
const isUserGroupLeader = group && (group.leader
&& group.leader._id === userId);
const isUserGroupManager = group && (group.managers
+1
View File
@@ -21,6 +21,7 @@ async function castTaskSpell (res, req, targetId, user, spell, quantity = 1) {
if (!targetId) throw new BadRequest(res.t('targetIdUUID'));
const task = await Tasks.Task.findOne({
userId: user._id,
_id: targetId,
}).exec();
if (!task) throw new NotFound(res.t('messageTaskNotFound'));
+1 -1
View File
@@ -138,7 +138,7 @@ export async function update (req, res, { isV3 = false }) {
if (!Array.isArray(groupsToMirror)) {
throw new BadRequest('Groups to copy tasks from must be an array.');
}
const memberGroups = user.guilds;
const memberGroups = _.clone(user.guilds);
if (user.party._id) memberGroups.push(user.party._id);
for (const targetGroup of groupsToMirror) {
if (memberGroups.indexOf(targetGroup) === -1) {