Allow to unassign current user from card
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -24,9 +24,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<div @click.stop.prevent>
|
<div @click.stop.prevent>
|
||||||
<Actions v-if="canEdit && !isArchived">
|
<Actions v-if="canEdit && !isArchived">
|
||||||
<ActionButton v-if="showArchived === false" icon="icon-user" @click="assignCardToMe()">
|
<ActionButton v-if="showArchived === false && !isCurrentUserAssigned" icon="icon-user" @click="assignCardToMe()">
|
||||||
{{ t('deck', 'Assign to me') }}
|
{{ t('deck', 'Assign to me') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
|
<ActionButton v-if="showArchived === false && isCurrentUserAssigned" icon="icon-user" @click="unassignCardFromMe()">
|
||||||
|
{{ t('deck', 'Unassign myself') }}
|
||||||
|
</ActionButton>
|
||||||
<ActionButton icon="icon-archive" @click="archiveUnarchiveCard()">
|
<ActionButton icon="icon-archive" @click="archiveUnarchiveCard()">
|
||||||
{{ showArchived ? t('deck', 'Unarchive card') : t('deck', 'Archive card') }}
|
{{ showArchived ? t('deck', 'Unarchive card') : t('deck', 'Archive card') }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
@@ -114,6 +117,9 @@ export default {
|
|||||||
return board.id !== this.currentBoard.id
|
return board.id !== this.currentBoard.id
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
isCurrentUserAssigned() {
|
||||||
|
return this.card.assignedUsers.find((item) => item.type === 0 && item.participant.uid === getCurrentUser()?.uid)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openCard() {
|
openCard() {
|
||||||
@@ -126,9 +132,17 @@ export default {
|
|||||||
this.$store.dispatch('archiveUnarchiveCard', { ...this.card, archived: !this.card.archived })
|
this.$store.dispatch('archiveUnarchiveCard', { ...this.card, archived: !this.card.archived })
|
||||||
},
|
},
|
||||||
assignCardToMe() {
|
assignCardToMe() {
|
||||||
this.copiedCard = Object.assign({}, this.card)
|
|
||||||
this.$store.dispatch('assignCardToUser', {
|
this.$store.dispatch('assignCardToUser', {
|
||||||
card: this.copiedCard,
|
card: this.card,
|
||||||
|
assignee: {
|
||||||
|
userId: getCurrentUser()?.uid,
|
||||||
|
type: 0,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
unassignCardFromMe() {
|
||||||
|
this.$store.dispatch('removeUserFromCard', {
|
||||||
|
card: this.card,
|
||||||
assignee: {
|
assignee: {
|
||||||
userId: getCurrentUser()?.uid,
|
userId: getCurrentUser()?.uid,
|
||||||
type: 0,
|
type: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user