Improve logic to restore changes on the share object when cancelling the edition in SharingDetailsTab
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
While reviewing the backport of https://github.com/nextcloud/server/pull/63227, I had a thought: could we snapshot and restore share.attributes, as we already do for permissions? Restoring only hasDownloadPermission may add an attribute that did not previously exist (its setter calls setAttribute()) and misses others such as config/grid_view.
Alternatively, could we keep a single snapshot of all editor-owned share properties and restore it on cancel, rather than maintaining separate initial* fields? That would make future editable properties less likely to be missed.
Originally posted by @joshtrichards in https://github.com/nextcloud/server/pull/63227#discussion_r3867465910
Additional comment by @danxuliu:
What I originally tried to implement was copying the provided share object, working with the copy in the SharingDetailsTab view and, then, once it was successfully saved, "commit" the changes back to the original share object (or maybe even replace it).
Unfortunately I did not manage to do that and went the easy (and problematic) way, but it could be an alternative implementation to the above.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating SharingDetailsTab and reading the existing snapshot and restore logic for permissions and hasDownloadPermission. Trace the cancel and successful-save paths, then determine how share.attributes and other editor-owned properties are handled. Done means cancelling restores the complete prior share state without introducing or losing attributes, with the existing SharingDetailsTab tests updated or extended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100