Skip to content

[FEATURE REQUEST] Edit link over a space#4817

Open
joragua wants to merge 9 commits intomasterfrom
feature/edit_space_link
Open

[FEATURE REQUEST] Edit link over a space#4817
joragua wants to merge 9 commits intomasterfrom
feature/edit_space_link

Conversation

@joragua
Copy link
Copy Markdown
Contributor

@joragua joragua commented Apr 9, 2026

Related Issues

App: #4756

  • 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

@joragua joragua self-assigned this Apr 9, 2026
@joragua joragua force-pushed the feature/edit_space_link branch from 68b51f8 to 02b0e0e Compare April 9, 2026 11:28
@joragua joragua linked an issue Apr 9, 2026 that may be closed by this pull request
12 tasks
@joragua joragua force-pushed the feature/edit_space_link branch 3 times, most recently from 3c30678 to c5a3011 Compare April 10, 2026 08:26
@jesmrec jesmrec force-pushed the feature/edit_space_link branch from 064f233 to dc46bde Compare April 10, 2026 11:27
@joragua joragua force-pushed the feature/edit_space_link branch from dc46bde to 8b936a5 Compare April 13, 2026 11:36
@joragua joragua closed this Apr 13, 2026
@joragua joragua force-pushed the feature/edit_space_link branch from 8b936a5 to 6ac162b Compare April 13, 2026 11:45
@jesmrec jesmrec reopened this Apr 13, 2026
@joragua joragua force-pushed the feature/edit_space_link branch 3 times, most recently from 076c8ac to d51f23a Compare April 17, 2026 12:54
@joragua joragua force-pushed the feature/edit_space_link branch from 4822a5c to 6f9dd9c Compare April 22, 2026 07:30
@joragua joragua marked this pull request as ready for review April 22, 2026 07:39
@joragua joragua requested a review from jesmrec April 22, 2026 07:40
Copy link
Copy Markdown
Contributor

@jesmrec jesmrec left a comment

Choose a reason for hiding this comment

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

Some comments from my side @joragua!

}

// Do not recreate the edit view after the first iteration
if (spaceLinksViewModel.addPublicLinkUIState.value?.selectedPermission != null) return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this condition to be the first in the bock to be checked? if no permission to return even before the name and the button are binded

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This condition is used to avoid re-creating the edit view when the device is rotated, but the button still needs to be bound because the default label is CREATE (it should be SAVE in edit mode). The text binding could be moved below the condition.

New version:

binding.createPublicLinkButton.apply { ... }

// Do not recreate the edit view after the first iteration
if (spaceLinksViewModel.addPublicLinkUIState.value?.selectedPermission != null) return

binding.publicLinkNameEditText.setText(it.displayName)

putParcelable(ARG_SELECTED_PUBLIC_LINK, selectedPublicLink)
}
return AddPublicLinkFragment().apply {
arguments = args
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I miss OnDestroyView in this fragment (not part of this specific review but...)

Copy link
Copy Markdown
Contributor Author

@joragua joragua Apr 22, 2026

Choose a reason for hiding this comment

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

Right! Added ✅ I've added onDestroyView method in SetPasswordDialogFragment too

expirationDate = expirationDate
).execute(client)

override fun editPasswordLink(spaceId: String, linkId: String, password: String?): RemoteOperationResult<Unit> =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be every parameter in a line break like the fun above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done 👍🏻

Comment on lines +121 to +145
_addPublicLinkUIState.value?.selectedPermission?.let {
runUseCaseWithResult(
coroutineDispatcher = coroutineDispatcherProvider.io,
flow = _editLinkResultFlow,
useCase = editLinkUseCase,
useCaseParams = EditLinkUseCase.Params(
accountName = accountName,
spaceId = space.id,
linkId = linkId,
displayName = displayName,
type = it,
expirationDate = _addPublicLinkUIState.value?.selectedExpirationDate,
)
)
if (_addPublicLinkUIState.value?.wasPasswordChanged == true) {
viewModelScope.launch(coroutineDispatcherProvider.io) {
editPasswordLinkUseCase(EditPasswordLinkUseCase.Params(
accountName = accountName,
spaceId = space.id,
linkId = linkId,
password = _addPublicLinkUIState.value?.selectedPassword
))
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there are two different calls since there are two request, that's right. But, what happens if the first request fails (for any reason)? imo, the second one should be cancelled. Not sure if this make sense or it is somehow controlled.

On the same way, what happens if EditLinkUseCase successes and EditPasswordLinkUseCase fails?

Even when they are two separate request, should they be handled together as an atomic operation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Edit a link over a space

2 participants