Group Tasks Shared Completion (#10515)

* WIP(groups): add shared completion prop
Also fix an issue where the Needs Approval toggle would not read/save 
correctly.

* fix(groups): save group options on task create
Also, correct count of assigned members when viewing user is among 
assignments

* fix(groups): display correct messages in two places

* fix(tasks): eliminate console error related to filtering
Also localize a group plans string

* WIP(groups): implement single completion for approval workflow

* WIP(groups): Add shared completion handling to no-approval-needed flow

* WIP(groups): cover approval flow case for all-assigned
Also save new field on initial task creation

* fix(tasks): use default sharedCompletion value when creating tasks

* WIP(tests): non-working draft test

* Added completed todo to group query

* WIP(group-tasks): fix bugs, add tests

* refactor(group-tasks): deleteMany op, add more tests

* refactor(group-tasks): move shared completion handling to lib

* WIP(group-tasks): broken refactor

* WIP(group-tasks): await all the things

* Turned complete master task to save

* WIP(group-tasks): show completed

* fix(filtering): don't try to filter if no list is passed

* refactor(group-tasks): load completed to-dos on demand, not at start

* fix(group-tasks): don't double up on repeat visits

* fix(group-tasks): include brief explanation in dropdown

* fix(group-tasks): improve wording some more
This commit is contained in:
Sabe Jones
2018-07-20 12:29:44 -05:00
committed by GitHub
parent 8b69540e71
commit 284b2cc413
13 changed files with 341 additions and 14 deletions

View File

@@ -185,6 +185,15 @@
:checked="requiresApproval",
@change="updateRequiresApproval"
)
.form-group(v-if="task.type === 'todo'")
label(v-once) {{ $t('sharedCompletion') }}
b-dropdown.inline-dropdown(:text="$t(sharedCompletion)")
b-dropdown-item(
v-for="completionOption in ['recurringCompletion', 'singleCompletion', 'allAssignedCompletion']",
:key="completionOption",
@click="sharedCompletion = completionOption",
:class="{active: sharedCompletion === completionOption}"
) {{ $t(completionOption) }}
.advanced-settings(v-if="task.type !== 'reward'")
.advanced-settings-toggle.d-flex.justify-content-between.align-items-center(@click = "showAdvancedOptions = !showAdvancedOptions")
@@ -691,6 +700,7 @@ export default {
calendar: calendarIcon,
}),
requiresApproval: false, // We can't set task.group fields so we use this field to toggle
sharedCompletion: 'recurringCompletion',
members: [],
memberNamesById: {},
assignedMembers: [],
@@ -811,6 +821,7 @@ export default {
});
this.assignedMembers = [];
if (this.task.group && this.task.group.assignedUsers) this.assignedMembers = this.task.group.assignedUsers;
if (this.task.group) this.sharedCompletion = this.task.group.sharedCompletion || 'recurringCompletion';
}
// @TODO: This whole component is mutating a prop and that causes issues. We need to not copy the prop similar to group modals
@@ -892,10 +903,13 @@ export default {
async submit () {
if (this.newChecklistItem) this.addChecklistItem();
// TODO Fix up permissions on task.group so we don't have to keep doing these hacks
if (this.groupId) {
this.task.group.assignedUsers = this.assignedMembers;
this.task.requiresApproval = this.requiresApproval;
this.task.group.approval.required = this.requiresApproval;
this.task.sharedCompletion = this.sharedCompletion;
this.task.group.sharedCompletion = this.sharedCompletion;
}
if (this.purpose === 'create') {