mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Sabrecat/groups quick wins (#11146)
* WIP(groups): quickish wins * WIP(groups): two quick wins 1. Don't show task creation button if user is not leader or manager 2. Don't require JS confirm() for approving tasks * fix(group-plans): allow delete from options button * fix(group-plans): update tasksOrder when task deleted * fix(group-tasks): dismiss notification when user takes action * refactor(tasks): DRY out create button styling * fix(group-tasks): sync after claiming/unclaiming * fix(claiming): better sync and notif handling * fix(tasks): force sync instead of explicitly clearing notif * fix(tasks): reposition task creation button * fix(group-tasks): default to single completion * fix(group-tasks): move completion condition field above approval switch * fix(group-tasks): todo validation error and approval notif dismissal * fix(group-tasks): default single completion on client * fix(group-tasks): move completion condition up more * fix(group-tasks): maintain client-side user assignment list * fix(group-tasks): remove approval notifications when task deleted * fix(group-tasks): send assigned task to top of task list * fix(group-tasks): remove useless tag filter dropdown * feat(group-tasks): notify user of assigned task * fix(group-tasks): don't allow approval of tasks w/ no approval request * fix(tests): adjust expectations * fix(group-tasks): more sensible action on assignment notif click
This commit is contained in:
@@ -159,6 +159,15 @@
|
||||
| {{ $t(frequency) }}
|
||||
|
||||
.option.group-options(v-if='groupId')
|
||||
.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) }}
|
||||
.form-group.row
|
||||
label.col-12(v-once) {{ $t('assignedTo') }}
|
||||
.col-12.mt-2
|
||||
@@ -179,23 +188,12 @@
|
||||
|
||||
.row
|
||||
button.btn.btn-primary(@click.stop.prevent="showAssignedSelect = !showAssignedSelect") {{$t('close')}}
|
||||
|
||||
.option.group-options(v-if='groupId')
|
||||
.form-group
|
||||
label(v-once) {{ $t('approvalRequired') }}
|
||||
toggle-switch.d-inline-block(
|
||||
: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")
|
||||
@@ -711,7 +709,7 @@ export default {
|
||||
calendar: calendarIcon,
|
||||
}),
|
||||
requiresApproval: false, // We can't set task.group fields so we use this field to toggle
|
||||
sharedCompletion: 'recurringCompletion',
|
||||
sharedCompletion: 'singleCompletion',
|
||||
members: [],
|
||||
memberNamesById: {},
|
||||
assignedMembers: [],
|
||||
@@ -842,7 +840,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';
|
||||
if (this.task.group) this.sharedCompletion = this.task.group.sharedCompletion || 'singleCompletion';
|
||||
}
|
||||
|
||||
// @TODO: This whole component is mutating a prop and that causes issues. We need to not copy the prop similar to group modals
|
||||
@@ -926,7 +924,6 @@ export default {
|
||||
|
||||
// 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;
|
||||
@@ -954,6 +951,7 @@ export default {
|
||||
});
|
||||
});
|
||||
Promise.all(promises);
|
||||
this.task.group.assignedUsers = this.assignedMembers;
|
||||
this.$emit('taskCreated', this.task);
|
||||
} else {
|
||||
this.createTask(this.task);
|
||||
|
||||
Reference in New Issue
Block a user