Skip to content

Fix cancelling the customization of a share - #63227

Open
danxuliu wants to merge 10 commits into
masterfrom
fix-cancelling-the-customization-of-a-share
Open

Fix cancelling the customization of a share#63227
danxuliu wants to merge 10 commits into
masterfrom
fix-cancelling-the-customization-of-a-share

Conversation

@danxuliu

Copy link
Copy Markdown
Member

In the past shares were edited through a dropdown menu, and changed settings were immediately applied. Since #39472 a panel with the different settings and buttons to save and cancel the changes is used instead. However, some specific settings were still saved as soon as they were modified, even if the changes were later cancelled.

Besides that, the panel modifies the received share object whenever a setting is changed (even if they are not applied on the server), but the changes were not reverted when the edition was cancelled. Due to that, if the share was customized again after cancelling the previous changes were still there.

This pull request fixes all that by removing the immediate saving on those settings that still had it, and reverting the changes to the share object when the edition is cancelled.

Additionally it also fixes a problem when the password is removed and Video verification was checked (scenario 4 below) and a problem with how the new password was cleared (scenario 7 below). They were not really issues when cancelling the edition but when saving the share, but in the first case the code was quite related and in the second the effect was similar (inconsistent UI if the share was edited again), so they were included here.

How to test (scenario 1)

  • Open the Files app
  • Open the Sharing tab for a file
  • Create a public link share
  • Customize the share
  • Hide download

Result with this pull request

The share is not saved

Result without this pull request

The share is saved

How to test (scenario 2)

  • Open the Files app
  • Open the Sharing tab for a file
  • Create a public link share
  • Customize the share
  • Set a password
  • Cancel
  • Open the menu for the share
  • Close the menu by clicking outside it

Result with this pull request

The share is not saved

Result without this pull request

The share is saved

How to test (scenario 3)

  • Enable Talk
  • Open the Files app
  • Open the Sharing tab for a file
  • Create a public link share
  • Customize the share
  • Set a password
  • Enable video verification (only available after setting the password)

Result with this pull request

The share is not saved

Result without this pull request

The share is saved

How to test (scenario 4)

  • Enable Talk
  • Open the Files app
  • Open the Sharing tab for a file
  • Create a public link share
  • Customize the share
  • Set a password
  • Enable video verification (only available after setting the password)
  • Save the share
  • Reload the page
  • Customize the share
  • Remove the password
  • Save the share

Result with this pull request

Saving the share succeeds

Result without this pull request

Saving the share fails

How to test (scenario 5)

  • Enable Talk
  • Open the Files app
  • Open the Sharing tab for a file
  • Create a public link share
  • Customize the share
  • Set a label
  • Set a password
  • Enable video verification (only available after setting the password)
  • Set an expiration date
  • Hide download
  • Add a note to recipient
  • Customize permissions and add edit permission
  • Cancel
  • Customize the share again

Result with this pull request

Everything is back to the original state. If the page is reloaded and the share customized again everything is in the original state.

Result without this pull request

Everything is still set despite being cancelled. If the page is reloaded and the share customized again then the password, video verification and hide download are checked, but the rest is back to the original state.

How to test (scenario 6)

  • Open the Files app
  • Open the Sharing tab for a file
  • Add and save a share with a user
  • Customize the share
  • Set an expiration date
  • Disallow download and sync
  • Add a note to recipient
  • Customize permissions and remove edit permission
  • Cancel
  • Customize the share again

Result with this pull request

Everything is back to the original state. If the page is reloaded and the share customized again everything is in the original state.

Result without this pull request

Everything* is still set (or disallowed) despite being cancelled. If the page is reloaded and the share customized again everything is in the original state.

  • "Custom permissions" checkbox is not checked in the advanced permissions, but "Read, share" can be nevertheless seen in the quick permissions list

How to test (scenario 7)

  • Open the Files app
  • Open the Sharing tab for a file
  • Create a public link share
  • Customize the share
  • Set a password
  • Save the share
  • Customize the share
  • Remove the password
  • Save the share
  • Customize the share

Result with this pull request

The password is unchecked

Result without this pull request

The password is checked. If the page is reloaded and the share customized again the password is unchecked

The SharingDetailsTab provides buttons to cancel and save the share, so
the share should be saved only when doing it explicitly.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
"onNoteChange" is not called from anywhere, so "newNote" is never set
and therefore "onNoteSubmit" does nothing.

"onMenuClose" is not called from anywhere either in "SharingEntry".

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The SharingDetailsTab provides buttons to cancel and save the share, so
the share should be saved only when doing it explicitly.

Moreover, the documentation of "onPasswordSubmit" mentions that it was
saved when closing the menu because the password is the only property
that is not automatically synced, so this was clearly a legacy
behaviour.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The methods and properties were not used anywhere. There are very
similar ones in SharingDetailsTab, so it seems that they were a leftover
from when they were moved there.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
If video verification is enabled it is not possible to save a share
without a password. This could happen if the password is removed without
unchecking first the video verification. Therefore, if the password is
disabled now the video verification is also disabled when the share is
saved.

An alternative would be to disable the video verification in the share
object as soon as the password is disabled, even if it was not saved
yet. However the video verification was not disabled until the share is
saved to ensure that, for example, a misclick on the password does not
change the video verification state and forces the user to explicitly
enable it again.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The SharingDetailsTab provides buttons to cancel and save the share, so
the share should be saved only when doing it explicitly.

Note that although "saveShare()" only sends the password when it is
modified there is no need to explicitly send it for mail shares like it
was done in the removed code, as for mail shares the
"Video verification" checkbox is shown only when the password was
modified, so "password" is implicitly sent when "sendPasswordByTalk" is
sent.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This has been broken since it was refactored in
208ff80, although it seems that the
method was not used anywhere (not even when it was refactored).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu added this to the Nextcloud 35 milestone Aug 13, 2026
@danxuliu

danxuliu commented Aug 13, 2026

Copy link
Copy Markdown
Member Author

/backport to stable34 please

@danxuliu

Copy link
Copy Markdown
Member Author

/backport to stable33 please

@danxuliu

Copy link
Copy Markdown
Member Author

/backport to stable32 please

@danxuliu danxuliu self-assigned this Aug 13, 2026
@danxuliu
danxuliu force-pushed the fix-cancelling-the-customization-of-a-share branch 2 times, most recently from f48db9e to cc36550 Compare August 13, 2026 17:27
The SharingDetailsTab receives a share object and uses it as the model
to be edited from the UI components. Therefore, when the edition is
cancelled, the share object should be returned to its original state.
Otherwise any UI using the share object would still show the modified
state.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
"newPassword" is internally delegated by the share object to
"_share.newPassword" through getter and setter properties. Therefore
deleting "newPassword" has no effect, as there is no such attribute,
and it should be set to undefined instead.

Now that "newPassword" is correctly cleared "Set password" is no longer
checked if the share of a password is removed, the share is updated, and
the share is customized again (without reloading the page in the
meantime).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu
danxuliu force-pushed the fix-cancelling-the-customization-of-a-share branch from cc36550 to a79d951 Compare August 13, 2026 18:46
@danxuliu

Copy link
Copy Markdown
Member Author

/compile

Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@danxuliu danxuliu added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 13, 2026
@danxuliu
danxuliu marked this pull request as ready for review August 13, 2026 20:31
@danxuliu
danxuliu requested review from a team as code owners August 13, 2026 20:31
@danxuliu
danxuliu requested review from susnux and removed request for a team August 13, 2026 20:31
@danxuliu
danxuliu requested review from icewind1991, kristian-zendato, leftybournes, provokateurin, salmart-dev and skjnldsv and removed request for a team August 13, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants