From 734e4a963fd0b5f18be63036d1f51680e3ce2a15 Mon Sep 17 00:00:00 2001 From: Dexx Mandele Date: Mon, 30 Jul 2018 16:02:17 +0200 Subject: [PATCH] Re-enable start quest button (#10532) * Check for scroll during quest pre-selection * Re-enable start quest btn after error * Review: remove unused start quest method --- website/client/components/groups/group.vue | 18 --------------- .../components/groups/startQuestModal.vue | 22 ++++++++++++------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/website/client/components/groups/group.vue b/website/client/components/groups/group.vue index 9fa954da0f..93cb0fc692 100644 --- a/website/client/components/groups/group.vue +++ b/website/client/components/groups/group.vue @@ -539,24 +539,6 @@ export default { this.$store.state.upgradingGroup = this.group; this.$router.push('/group-plans'); }, - clickStartQuest () { - Analytics.track({ - hitType: 'event', - eventCategory: 'button', - eventAction: 'click', - eventLabel: 'Start a Quest', - }); - - let hasQuests = find(this.user.items.quests, (quest) => { - return quest > 0; - }); - - if (hasQuests) { - this.$root.$emit('bv::show::modal', 'start-quest-modal'); - return; - } - // $rootScope.$state.go('options.inventory.quests'); - }, showGroupGems () { this.$root.$emit('bv::show::modal', 'group-gems-modal'); }, diff --git a/website/client/components/groups/startQuestModal.vue b/website/client/components/groups/startQuestModal.vue index 66bee4afe1..9d13f2d0b3 100644 --- a/website/client/components/groups/startQuestModal.vue +++ b/website/client/components/groups/startQuestModal.vue @@ -148,8 +148,13 @@ export default { }; }, mounted () { - let questKeys = Object.keys(this.user.items.quests); - this.selectedQuest = questKeys[0]; + const userQuests = this.user.items.quests; + for (const key in userQuests) { + if (userQuests[key] > 0) { + this.selectedQuest = key; + break; + } + } this.$root.$on('selectQuest', this.selectQuest); }, @@ -177,13 +182,14 @@ export default { let groupId = this.group._id || this.user.party._id; const key = this.selectedQuest; - const response = await this.$store.dispatch('guilds:inviteToQuest', {groupId, key}); - const quest = response.data.data; - - if (this.$store.state.party.data) this.$store.state.party.data.quest = quest; - - this.loading = false; + try { + const response = await this.$store.dispatch('guilds:inviteToQuest', {groupId, key}); + const quest = response.data.data; + if (this.$store.state.party.data) this.$store.state.party.data.quest = quest; + } finally { + this.loading = false; + } this.$root.$emit('bv::hide::modal', 'start-quest-modal'); }, },