Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Board: Fix card members update #1620

Merged
merged 3 commits into from
May 4, 2022
Merged

Board: Fix card members update #1620

merged 3 commits into from
May 4, 2022

Conversation

Dvinyanin
Copy link
Contributor

Signed-off-by: Dvinyanin Alexandr dvinyanin.alexandr@gmail.com

Unverified

This user has not yet uploaded their public signing key.
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
@Dvinyanin Dvinyanin requested review from haiodo and annano May 2, 2022 13:01
@Dvinyanin Dvinyanin linked an issue May 2, 2022 that may be closed by this pull request
@@ -67,3 +67,20 @@ export function archiveCard (card: Card, client: Client): Promise<TxResult> | un
export function unarchiveCard (card: Card, client: Client): Promise<TxResult> | undefined {
return updateCard(client, card, 'isArchived', false)
}

export function updateCardMembers (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use one transaction with both $push: { members: [newMembers] } and $pull: { members: [oldMemebrs]}. Please check if it working, or at least two transactions instead of multiple ones.
Also pleas make function async and return Promise, it will be faster and less transactions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$pull doesn't support array
https://github.com/hcengineering/anticrm/blob/eb9526f0153f10550c1eb537dd8c176d31921cf8/packages/core/src/operator.ts#L42
Also using both operators cause
ERROR: platform:status:UnknownError {"message":"Updating the path 'members' would create a conflict at 'members'"}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose $pull: {values: {$in: array}} should work, at least for mongoDb,
if so we could fix it for our $pull implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Dvinyanin added 2 commits May 2, 2022 21:19

Unverified

This user has not yet uploaded their public signing key.
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>

Unverified

This user has not yet uploaded their public signing key.
Signed-off-by: Dvinyanin Alexandr <dvinyanin.alexandr@gmail.com>
@haiodo haiodo merged commit 0cec2cb into main May 4, 2022
@haiodo haiodo deleted the fix-1561 branch May 4, 2022 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Use $push/$pull for UserBoxList component (instead of update)
2 participants