mirror of
https://github.com/HabitRPG/habitica.git
synced 2026-04-23 13:49:22 -05:00
fix(misc): correct one groups issue and two others
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user