-
Notifications
You must be signed in to change notification settings - Fork 496
fix(sharing): Use insertIfNotExists to insert share exceptions to red… #15568
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
base: main
Are you sure you want to change the base?
Conversation
…uce concurrency issues Signed-off-by: Joas Schilling <[email protected]>
| $this->dbConnection->beginTransaction(); | ||
| $inserted = $this->dbConnection->insertIfNotExist('*PREFIX*share', [ | ||
| 'share_type' => self::SHARE_TYPE_USERROOM, | ||
| 'share_with' => $recipient, | ||
| 'uid_owner' => $share->getShareOwner(), | ||
| 'uid_initiator' => $share->getSharedBy(), | ||
| 'parent' => $share->getId(), | ||
| 'item_type' => $share->getNodeType(), | ||
| 'item_source' => $share->getNodeId(), | ||
| 'file_source' => $share->getNodeId(), | ||
| 'file_target' => $share->getTarget(), | ||
| 'permissions' => 0, | ||
| 'stime' => $share->getShareTime()->getTimestamp(), | ||
| ], ['share_type', 'share_with', 'parent']); | ||
| $this->dbConnection->commit(); | ||
|
|
||
| if ($inserted === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately wrapping insertIfNotExists in a transaction does not give more atomicity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While that is sad, the reduced roundtrip time should help
And the change here in deleteFromSelf which updates ALL share_type+with+parent items instead of the first one found by ID should solve the issue we are facing at the moment:
- After using "Unshare from self" and reloading the page, the share is visible again.
- THat should be fixed, as now all items have permissions = 0 and are not mounted
…uce concurrency issues
🛠️ API Checklist
🏁 Checklist
docs/has been updated or is not required