mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Group plan fixes (#9518)
* Fixed group plan editing * Added translations * Abstracted query for group or challenge tasks
This commit is contained in:
@@ -345,7 +345,10 @@ export default {
|
||||
if (editingGroup.summary) this.workingGroup.summary = editingGroup.summary;
|
||||
if (editingGroup.description) this.workingGroup.description = editingGroup.description;
|
||||
if (editingGroup._id) this.workingGroup.id = editingGroup._id;
|
||||
if (editingGroup.leader._id) this.workingGroup.newLeader = editingGroup.leader._id;
|
||||
if (editingGroup.leader._id) {
|
||||
this.workingGroup.newLeader = editingGroup.leader._id;
|
||||
this.workingGroup.currentLeaderId = editingGroup.leader._id;
|
||||
}
|
||||
if (editingGroup._id) this.getMembers();
|
||||
},
|
||||
},
|
||||
@@ -424,14 +427,19 @@ export default {
|
||||
});
|
||||
this.workingGroup.categories = serverCategories;
|
||||
|
||||
let groupData = Object.assign({}, this.workingGroup);
|
||||
if (groupData.newLeader === this.workingGroup.currentLeaderId) {
|
||||
groupData.leader = this.workingGroup.currentLeaderId;
|
||||
}
|
||||
|
||||
let newgroup;
|
||||
if (this.workingGroup.id) {
|
||||
await this.$store.dispatch('guilds:update', {group: this.workingGroup});
|
||||
if (groupData.id) {
|
||||
await this.$store.dispatch('guilds:update', {group: groupData});
|
||||
this.$root.$emit('updatedGroup', this.workingGroup);
|
||||
// @TODO: this doesn't work because of the async resource
|
||||
// if (updatedGroup.type === 'party') this.$store.state.party = {data: updatedGroup};
|
||||
} else {
|
||||
newgroup = await this.$store.dispatch('guilds:create', {group: this.workingGroup});
|
||||
newgroup = await this.$store.dispatch('guilds:create', {group: groupData});
|
||||
this.$store.state.user.data.balance -= 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user