mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Group Plans quick wins (#11107)
* 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
This commit is contained in:
@@ -35,8 +35,10 @@ div
|
||||
import findIndex from 'lodash/findIndex';
|
||||
import { mapState } from 'client/libs/store';
|
||||
import approvalModal from './approvalModal';
|
||||
import sync from 'client/mixins/sync';
|
||||
|
||||
export default {
|
||||
mixins: [sync],
|
||||
props: ['task', 'group'],
|
||||
components: {
|
||||
approvalModal,
|
||||
@@ -91,11 +93,12 @@ export default {
|
||||
taskId = this.task.group.taskId;
|
||||
}
|
||||
|
||||
this.$store.dispatch('tasks:assignTask', {
|
||||
await this.$store.dispatch('tasks:assignTask', {
|
||||
taskId,
|
||||
userId: this.user._id,
|
||||
});
|
||||
this.task.group.assignedUsers.push(this.user._id);
|
||||
this.sync();
|
||||
},
|
||||
async unassign () {
|
||||
if (!confirm(this.$t('confirmUnClaim'))) return;
|
||||
@@ -106,15 +109,16 @@ export default {
|
||||
taskId = this.task.group.taskId;
|
||||
}
|
||||
|
||||
this.$store.dispatch('tasks:unassignTask', {
|
||||
await this.$store.dispatch('tasks:unassignTask', {
|
||||
taskId,
|
||||
userId: this.user._id,
|
||||
});
|
||||
let index = this.task.group.assignedUsers.indexOf(this.user._id);
|
||||
this.task.group.assignedUsers.splice(index, 1);
|
||||
|
||||
this.sync();
|
||||
},
|
||||
approve () {
|
||||
if (!confirm(this.$t('confirmApproval'))) return;
|
||||
let userIdToApprove = this.task.group.assignedUsers[0];
|
||||
this.$store.dispatch('tasks:approve', {
|
||||
taskId: this.task._id,
|
||||
|
||||
Reference in New Issue
Block a user