Workaround/quick-fix for broken resharing issue #14082 #14084
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a workaround for broken resharing issue in issue #14082
Partly introduced in PR #12626
Problem 1 causes an exception to be thrown because of incorrect arguments
Problem 2 is a bit more tricky
The issue is that the share object is initialized differently when passed to createShareActivity().
Via ShareAPIController:deleteShare() and $this->getShareById($id) the Node in the share object is initiated on the owner of the share.
Via ShareAPIController:createShare() the Node in the share object is instantiated based on the logged in user (or share initiator).
This means that createShareActivity() is called with the same IShare object but the node is pointing either to owner or initiator depending on if it is a create or delete.
This fix is a quick workaround to cope with this issue, even though the root cause need to be investigated.