Group plan fixes (#9437)

* Prevented title editing on personal page

* Fixed claim/unlclaim from user task page

* Removed task from local on delete

* Immediately show unassigned bar

* Add move to group tasks

* Fixed group member count increase

* Added upgrade when group plan is canceled
This commit is contained in:
Keith Holliday
2017-11-14 16:54:11 -07:00
committed by GitHub
parent bddafd4392
commit eaa91b2a09
7 changed files with 68 additions and 20 deletions

View File

@@ -76,24 +76,36 @@ export default {
},
},
methods: {
claim () {
async claim () {
if (!confirm('Are you sure you want to claim this task?')) return;
let taskId = this.task._id;
// If we are on the user task
if (this.task.userId) {
taskId = this.task.group.taskId;
}
this.$store.dispatch('tasks:assignTask', {
taskId: this.task._id,
taskId,
userId: this.user._id,
});
this.task.group.assignedUsers.push(this.user._id);
// @TODO: Reload user tasks?
},
unassign () {
async unassign () {
if (!confirm('Are you sure you want to unclaim this task?')) return;
let taskId = this.task._id;
// If we are on the user task
if (this.task.userId) {
taskId = this.task.group.taskId;
}
this.$store.dispatch('tasks:unassignTask', {
taskId: this.task._id,
taskId,
userId: this.user._id,
});
let index = this.task.group.assignedUsers.indexOf(this.user._id);
this.task.group.assignedUsers.splice(index, 1);
// @TODO: Reload user tasks?
},
approve () {
if (!confirm('Are you sure you want to approve this task?')) return;