HabitRPG/habitrpg — pull request #4002 by Alys (2014-09-08 21:10:54+00:00)
Title: add Cancel button for quests, allow party to cancel/abort if quest owner missing, add Debug tools for quest testing

Requires https://github.com/HabitRPG/habitrpg-shared/pull/302

There's a few parts to this but all related:

- When a party member is removed from a party, also remove them from the group.quest.members list.
- Add Cancel button for quests in invite stage, and API cancel function. I.e., the quest owner can either Begin or Cancel a quest. If the quest owner has been removed from the party, then any party member can cancel (quest owner keeps the scroll).
- If the quest owner has left the quest or left the party and another owner has not been assigned, the text under the participant list explains this.
- If the quest owner has left the quest or left the party and another owner has not been assigned, any party member can now abort the quest (or cancel it if it hasn't started yet). See below for why. Quest owner regains the scroll.
- New Debug tools in footer to make it easier to test quest behaviour (that's the only reason for changes to `public/js/controllers/footerCtrl.js` and `views/shared/footer.jade`).
- Minor text improvements and removing an outdated comment.

Reasons for allowing any party member to abort quest when quest owner is gone:

With the current site code, it's possible for parties to get into a state where they can't start a new quest or are stuck in a quest that's too hard/slow for them, because the quest owner is no longer in the party or is in the party but is not in the quest [1]. The worst case is that no one now in the party is participating in the quest, so the quest will never finish.

If the quest owner left voluntarily, then a new quest owner would have been assigned and the quest would continue as normal, but that does not happen (and should not happen?) when the quest owner is removed from the party by the party leader. When the quest owner is no longer part of the quest, this PR lets any party member cancel the quest before it has begun, or abort it while it is running.

I realise that allowing any member to abort a running quest is open to abuse, but I think it's a better situation than having a party stuck in a quest that they have no control over (especially if none of them are participating in the quest). The current workaround for that situation is for everyone to leave the party and form a new one, which is annoying to do and which is not an obvious solution - parties need to be told to do that by support staff.

I think the chances of abuse are relatively low, and would only occur in parties that had already got themselves into a bad situation.

A party cannot use this to steal a scroll from a quest owner, because when the quest is aborted, the scroll returns to the owner even if the owner is not in the party. From this point of view, I think allowing any party member to abort a quest when the quest owner has been forcibly removed is LESS open to abuse than assigning a new quest owner when the original owner has been booted. That latter case would let the new quest owner steal the scroll.

It would be possible to allow a quest to be aborted by only the party leader after the quest owner has left, but that wouldn't help in cases where the party leader is no longer using HabitRPG. Allowing any party member to abort gives all stuck parties the opportunity to remove unwanted quests.

[1] A quest owner can be in a party but not part of the quest if the leader boots them out while the quest is running but then someone else invites them back in.