Skip to content

feat: edit a public link on an oCIS server - #5044

Merged
jesmrec merged 11 commits into
masterfrom
feature/edit_public_link_sharing_ng
Nov 11, 2026
Merged

jesmrec merged 11 commits into
masterfrom
feature/edit_public_link_sharing_ng

Conversation

@joragua

@joragua joragua commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Related Issues

App: #4970

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (if required)

QA

Test plan: https://github.com/owncloud/QA/blob/android/sharing_ng/Mobile/Android/Executions/Release_4.9/NG%20-%20Edit%20link.md

@joragua joragua self-assigned this Nov 4, 2026
@joragua joragua linked an issue Nov 4, 2026 that may be closed by this pull request
11 tasks done
@joragua joragua closed this Nov 4, 2026
@joragua
joragua force-pushed the feature/edit_public_link_sharing_ng branch from b6802f5 to 036014d Compare November 4, 2026 12:52
@joragua joragua reopened this Nov 4, 2026
@joragua
joragua force-pushed the feature/edit_public_link_sharing_ng branch from 8d4f8ac to 7676799 Compare November 4, 2026 16:33
@joragua
joragua marked this pull request as ready for review November 6, 2026 09:09
@joragua
joragua requested a review from a team as a code owner November 6, 2026 09:09

@jesmrec jesmrec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CR with just one comment.

Comment on lines +269 to +296
private fun observeEditLinkResult() {
collectLatestLifecycleFlow(publicLinksViewModel.editLinkResultFlow) { event ->
event?.peekContent()?.let { uiResult ->
when (uiResult) {
is UIResult.Loading -> { }
is UIResult.Success -> {
if (publicLinksViewModel.addPublicLinkUIState.value?.wasPasswordChanged != true) {
graphShareViewModel.getGraphShares()
showMessageInSnackbar(getString(R.string.public_link_edit_correctly))
}
publicLinksViewModel.resetViewModel()
}
is UIResult.Error -> { }
}
}
}
}

private fun observeEditPasswordLinkResult() {
collectLatestLifecycleFlow(publicLinksViewModel.editPasswordLinkResultFlow) { event ->
event?.peekContent()?.let { uiResult ->
when (uiResult) {
is UIResult.Loading -> { }
is UIResult.Success -> {
graphShareViewModel.getGraphShares()
showMessageInSnackbar(getString(R.string.public_link_edit_correctly))
}
is UIResult.Error -> { }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If both password and other field change, observers handle information separately, so, we'll see two snackbars, one for the password, another for the other fields. Same for the getGraphShares call. Is that correct or am i missing something?

OTOH, if password request fails, will the editLink request be launched?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Only one snackbar will appear in the screen. The PATCH is not triggered unless the POST (password operation) success. If the password request fails, the editLink will not be launched

@joragua
joragua force-pushed the feature/edit_public_link_sharing_ng branch from a5cec2a to d9cf8b8 Compare November 9, 2026 13:29
@joragua

joragua commented Nov 9, 2026 •

Copy link
Copy Markdown
Member Author

Regarding a914f8b

Consolidate edit link result handling into a single observer. Previously, success and error were split across observeEditLinkResult and observeEditPasswordLinkResult, causing a race condition on list refresh and silent failures when the link PATCH failed after a successful password update. observeEditPasswordLinkResult has been removed from both GraphShareFragment and SpaceMembersFragment

@joragua
joragua requested a review from jesmrec November 9, 2026 13:52
@joragua
joragua force-pushed the feature/edit_public_link_sharing_ng branch 2 times, most recently from 1bda377 to a914f8b Compare November 10, 2026 08:29
jesmrec
jesmrec previously approved these changes Nov 10, 2026

@jesmrec jesmrec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CR Approved 🚀

Moving to QA

@jesmrec

jesmrec commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

(1) [FIXED]

In a server with no mandatory password, or server with mandatory password for writeable links (using can view)

  1. Create a link with password
  2. Click on pencil to edit the link
  3. Switch the password off
  4. Save
  5. Click on pencil to edit again

Current: Password switch enabled

Expected: Password switch disabled

Xiaomi redmi 13, Android 15
a914f8b6

@joragua

joragua commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

(1) should be fixed with the commit c22c4c6

EditRemotePasswordLinkOperation now serializes a null password as JSON null (JSONObject.NULL) instead of a literal "null" string, fixing password-removal requests. PublicLinksDiffUtil now compares hasPassword so the list recognizes a password change and rebinds the row.

@jesmrec

jesmrec commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

(2) (regression) [WONT FIX]

In a server with mandatory password for writeable links:

  1. Create a link with Can edit -> password mandatory
  2. Edit the link with the pencil
  3. Click on REMOVE to delete the password (Save disabled)
  4. Select Can view as new permission (Save enabled)

Current: Public link could not be created because password in mandatory

Expected: Public link created because new permission allows to create with no password

Reproducible also in spaces' links. It's a regression since it is also reproducible in master and latest

Xiaomi redmi 13, Android 15
`c22c4c61dc

@jesmrec

jesmrec commented Nov 11, 2026

Copy link
Copy Markdown
Member

(2) is won't fix as expected behaviour. Firstly, the password request is sent as an empty password without the permission change sent (PATCH comes later), so, the error is because the password cannot be removed. Race condition caused by the separated request to update password, on one side, and the other fields, on the other side.

@jesmrec

jesmrec commented Nov 11, 2026

Copy link
Copy Markdown
Member

Approved on my side

@jesmrec
jesmrec force-pushed the feature/edit_public_link_sharing_ng branch from c22c4c6 to fcc2268 Compare November 11, 2026 13:36
@jesmrec
jesmrec self-requested a review November 11, 2026 13:44
jesmrec
jesmrec previously approved these changes Nov 11, 2026
@jesmrec
jesmrec merged commit 499d91f into master Nov 11, 2026
@jesmrec
jesmrec deleted the feature/edit_public_link_sharing_ng branch November 11, 2026 15:47
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.

[FEATURE REQUEST] Sharing NG: Edit existing link

2 participants