mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-16 11:11:43 +00:00
fix(misc): correct one groups issue and two others
This commit is contained in:
parent
6aabf7b19a
commit
7129639bbf
3 changed files with 4 additions and 2 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue