Skip to content

Commit

Permalink
Merge branch 'sabrecat/more-group-fixes' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreCat committed Aug 17, 2023
2 parents 63414a8 + e73e8bf commit 0f9adf6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
35 changes: 22 additions & 13 deletions website/client/src/components/avatar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div
v-if="member.preferences"
class="avatar"
:style="{width, height, paddingTop}"
:class="backgroundClass"
Expand Down Expand Up @@ -184,9 +185,11 @@ export default {
currentEventList: 'worldState.data.currentEventList',
}),
hasClass () {
if (!this.member) return false;
return this.$store.getters['members:hasClass'](this.member);
},
isBuffed () {
if (!this.member) return false;
return this.$store.getters['members:isBuffed'](this.member);
},
paddingTop () {
Expand All @@ -197,28 +200,30 @@ export default {
let val = '24px';
if (!this.avatarOnly) {
if (this.member.items.currentPet) val = '24px';
if (this.member.items.currentMount) val = '0px';
if (this.member?.items.currentPet) val = '24px';
if (this.member?.items.currentMount) val = '0px';
}
return val;
},
backgroundClass () {
const { background } = this.member.preferences;
if (this.member) {
const { background } = this.member.preferences;
const allowToShowBackground = !this.avatarOnly || this.withBackground;
const allowToShowBackground = !this.avatarOnly || this.withBackground;
if (this.overrideAvatarGear && this.overrideAvatarGear.background) {
return `background_${this.overrideAvatarGear.background}`;
}
if (this.overrideAvatarGear && this.overrideAvatarGear.background) {
return `background_${this.overrideAvatarGear.background}`;
}
if (background && allowToShowBackground) {
return `background_${this.member.preferences.background}`;
if (background && allowToShowBackground) {
return `background_${this.member.preferences.background}`;
}
}
return '';
},
visualBuffs () {
if (!this.member) return {};
return {
snowball: `avatar_snowball_${this.member.stats.class}`,
spookySparkles: 'ghost',
Expand All @@ -227,15 +232,16 @@ export default {
};
},
skinClass () {
if (!this.member) return '';
const baseClass = `skin_${this.member.preferences.skin}`;
return `${baseClass}${this.member.preferences.sleep ? '_sleep' : ''}`;
},
costumeClass () {
return this.member.preferences.costume ? 'costume' : 'equipped';
return this.member?.preferences.costume ? 'costume' : 'equipped';
},
specialMountClass () {
if (!this.avatarOnly && this.member.items.currentMount && this.member.items.currentMount.includes('Kangaroo')) {
if (!this.avatarOnly && this.member?.items.currentMount && this.member?.items.currentMount.includes('Kangaroo')) {
return 'offset-kangaroo';
}
Expand All @@ -248,12 +254,13 @@ export default {
)) {
return this.foolPet(this.member.items.currentPet);
}
if (this.member.items.currentPet) return `Pet-${this.member.items.currentPet}`;
if (this.member?.items.currentPet) return `Pet-${this.member.items.currentPet}`;
return '';
},
},
methods: {
getGearClass (gearType) {
if (!this.member) return '';
let result = this.member.items.gear[this.costumeClass][gearType];
if (this.overrideAvatarGear && this.overrideAvatarGear[gearType]) {
Expand All @@ -263,6 +270,7 @@ export default {
return result;
},
hideGear (gearType) {
if (!this.member) return true;
if (gearType === 'weapon') {
const equippedWeapon = this.member.items.gear[this.costumeClass][gearType];
Expand All @@ -288,6 +296,7 @@ export default {
this.$root.$emit('castEnd', this.member, 'user', e);
},
showAvatar () {
if (!this.member) return false;
if (!this.showVisualBuffs) return true;
const { buffs } = this.member.stats;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<challenge-modal
:group-id="groupId"
:group-id="group._id"
@createChallenge="challengeCreated"
/>
<div
Expand Down
4 changes: 2 additions & 2 deletions website/client/src/components/chat/chatMessages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
v-if="user._id !== msg.uuid && msg.uuid !== 'system'"
class="avatar-left"
:class="{ invisible: avatarUnavailable(msg) }"
:member="msg.userStyles || cachedProfileData[msg.uuid]"
:member="msg.userStyles || cachedProfileData[msg.uuid] || {}"
:avatar-only="true"
:hide-class-badge="true"
:override-top-padding="'14px'"
Expand All @@ -58,7 +58,7 @@
<avatar
v-if="user._id === msg.uuid"
:class="{ invisible: avatarUnavailable(msg) }"
:member="msg.userStyles || cachedProfileData[msg.uuid]"
:member="msg.userStyles || cachedProfileData[msg.uuid] || {}"
:avatar-only="true"
:hide-class-badge="true"
:override-top-padding="'14px'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default {
}
await this.$store.dispatch('guilds:join', { groupId: group.id, type: 'guild' });
this.$router.push({ name: 'guild', params: { groupId: group.id } });
this.$router.push({ name: 'groupPlanDetailTaskInformation', params: { groupId: group.id } });
},
reject () {
this.$store.dispatch('guilds:rejectInvite', { groupId: this.notification.data.id, type: 'guild' });
Expand Down
5 changes: 2 additions & 3 deletions website/server/controllers/api-v3/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,10 +461,9 @@ api.getChallengeTasks = {
const group = await Group.getGroup({
user,
groupId: challenge.group,
fields: '_id type privacy',
optionalMembership: true,
fields: '_id type privacy purchased',
});
if (!group || !challenge.canView(user, group)) throw new NotFound(res.t('challengeNotFound'));
if (!group && !challenge.canView(user, group)) throw new NotFound(res.t('challengeNotFound'));

const tasks = await getTasks(req, res, { user, challenge });
return res.respond(200, tasks);
Expand Down

0 comments on commit 0f9adf6

Please sign in to comment.