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

@@ -35,9 +35,9 @@
h3(v-once) {{$t('theseAreYourTasks', {taskType: $t(types[type].label)})}}
.small-text {{$t(`${type}sDesc`)}}
.sortable-tasks(
ref="tasksList",
v-sortable='activeFilters[type].label !== "scheduled"',
@onsort='sorted',
ref="tasksList",
v-sortable='activeFilters[type].label !== "scheduled"',
@onsort='sorted',
data-sortableId
)
task(
@@ -441,20 +441,32 @@ export default {
}),
async sorted (data) {
const filteredList = this.taskList;
const taskIdToMove = filteredList[data.oldIndex]._id;
const taskToMove = filteredList[data.oldIndex];
const taskIdToMove = taskToMove._id;
let originTasks = this.tasks[`${this.type}s`];
if (this.taskListOverride) originTasks = this.taskListOverride;
// Server
const taskIdToReplace = filteredList[data.newIndex];
const newIndexOnServer = this.tasks[`${this.type}s`].findIndex(taskId => taskId === taskIdToReplace);
let newOrder = await this.$store.dispatch('tasks:move', {
taskId: taskIdToMove,
position: newIndexOnServer,
});
this.user.tasksOrder[`${this.type}s`] = newOrder;
const newIndexOnServer = originTasks.findIndex(taskId => taskId === taskIdToReplace);
let newOrder;
if (taskToMove.group.id) {
newOrder = await this.$store.dispatch('tasks:moveGroupTask', {
taskId: taskIdToMove,
position: newIndexOnServer,
});
} else {
newOrder = await this.$store.dispatch('tasks:move', {
taskId: taskIdToMove,
position: newIndexOnServer,
});
}
if (!this.taskListOverride) this.user.tasksOrder[`${this.type}s`] = newOrder;
// Client
const deleted = this.tasks[`${this.type}s`].splice(data.oldIndex, 1);
this.tasks[`${this.type}s`].splice(data.newIndex, 0, deleted[0]);
const deleted = originTasks.splice(data.oldIndex, 1);
originTasks.splice(data.newIndex, 0, deleted[0]);
},
async moveTo (task, where) { // where is 'top' or 'bottom'
const taskIdToMove = task._id;