Added confirmation step at begin button for quest (#9199)

* Added confirmation step at begin button for quest

* Fixed the 3 errors caused by questConfirm method in travis-ci
This commit is contained in:
Sarvesh Kakodkar
2017-11-28 07:35:05 +05:30
committed by Sabe Jones
parent b3870e5f34
commit b323abd225
2 changed files with 10 additions and 1 deletions

View File

@@ -15,7 +15,7 @@
questDialogContent(:item="questData")
div.text-center.actions(v-if='canEditQuest')
div
button.btn.btn-secondary(v-once, @click="questForceStart()") {{ $t('begin') }}
button.btn.btn-secondary(v-once, @click="questConfirm()") {{ $t('begin') }}
// @TODO don't allow the party leader to start the quest until the leader has accepted or rejected the invitation (users get confused and think "begin" means "join quest")
div
.cancel(v-once, @click="questCancel()") {{ $t('cancel') }}
@@ -195,6 +195,14 @@ export default {
},
},
methods: {
async questConfirm () {
let count = 0;
for (let uuid in this.group.quest.members) {
if (this.group.quest.members[uuid]) count += 1;
}
if (!confirm(this.$t('questConfirm', { questmembers: count, totalmembers: this.group.memberCount}))) return;
this.questForceStart();
},
async questForceStart () {
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/force-start'});
this.group.quest = quest;