Merge pull request #1458 from hcengineering/ano/use-push-action-on-join

Board: Use $push for join action
This commit is contained in:
Anna No 2022-04-20 12:10:22 +07:00 committed by GitHub
commit c24a27c2ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,14 +40,12 @@ export function hasDate (card: Card): boolean {
export function addCurrentUser (card: Card, client: Client): void {
const employee = (getCurrentAccount() as EmployeeAccount).employee
const members = card.members ?? []
if (members.includes(employee)) {
if (card.members?.includes(employee)) {
return
}
members.push(employee)
updateCard(client, card, 'members', members)
client.update(card, { $push: { members: employee } })
}
export function archiveCard (card: Card, client: Client): void {