Skip to content

fix: refresh share badges when folder etag is unchanged - #5013

Open
mvanhorn wants to merge 3 commits into
owncloud:masterfrom
mvanhorn:fix/4938-oc10-sharing-badges-refresh
Open

mvanhorn wants to merge 3 commits into
owncloud:masterfrom
mvanhorn:fix/4938-oc10-sharing-badges-refresh

Conversation

@mvanhorn

Copy link
Copy Markdown
Contributor

Related Issues

App:

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
    Not claimed: this diff changes no changelog or release-note file.
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (if required)
    Not claimed: ReleaseNotesViewModel.kt was not run locally either.

QA

When the etag still matches but sharedByLink, permissions, or the boolean sharedWithSharee value differ (null and false count as equal), that child is added to the files saved for the folder. The saved row keeps local properties, the existing etag, and the thumbnail-update flag, keeps the remote share fields, and is marked available offline through the parent when the parent is available offline. A unit test covers refreshFolder persisting a folder child in that case, and the unreleased changelog notes the badge refresh.

Pull to refresh on ownCloud 10 leaves folder share badges unchanged after a folder is shared or unshared in the web UI. The badges update only after that folder is opened and the user navigates back. Folder refresh writes a child back only when its etag differs from the local row. ownCloud 10 leaves the etag unchanged when only share metadata changes, so a new sharedByLink value, sharedWithSharee value, or permissions value is dropped.

Fixes #4938

AI was used for assistance.

@joragua joragua 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.

Thanks for the contribution @mvanhorn! Some comments about this PR

NOTE: Do not forget to split the changes into three commits: one for the fix, one for test (using the test: prefix) and another one for the calens file (chore: add calens file)

Comment thread changelog/unreleased/4938 Outdated
mvanhorn and others added 3 commits October 21, 2026 21:17
When the etag still matches but sharedByLink, permissions, or the
boolean sharedWithSharee value differ (null and false count as equal),
the child is now handled by the existing update branch in refreshFolder,
so its share fields are saved while local properties and the local etag
are kept.

Fixes owncloud#4938

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jP1NBrfG9D7pKJLkd5yre
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jP1NBrfG9D7pKJLkd5yre
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019jP1NBrfG9D7pKJLkd5yre
@mvanhorn
mvanhorn force-pushed the fix/4938-oc10-sharing-badges-refresh branch from b3b7759 to 72c0a3c Compare October 22, 2026 06:05
@mvanhorn

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @joragua. I've addressed everything:

  • Changelog: I renamed the file to changelog/unreleased/5013, added the PR link below the issue link, and removed the oC10 mention so the description covers oCIS too. It now follows TEMPLATE.md.
  • OCFileRepository line 409: you're right, the else-if was redundant. I moved the shareMetadataChanged(...) check into the condition of the branch above, so a child whose share metadata changed goes through the same update logic.
  • OCFileRepository line 634: I removed childWithRefreshedShareMetadata, since it duplicated the block starting at line 392. Only the small shareMetadataChanged helper is left.
  • Commits: I split the work into three: the fix, test: add test for refreshFolder when only share metadata changes, and chore: add calens file.

The OCFileRepositoryTest suite and the full owncloudData unit tests pass locally, and detekt is clean.

@joragua joragua 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.

The second CR round is here @mvanhorn! Just check the comments below and it should be ready for QA 😄

NOTE: It's not necessary to create new commits for the changes. You can rebase the branch and include the changes in the existing commits. Let us know if you have any doubts!

localChildToSync.localModificationTimestamp > remoteChild.lastSyncDateForData!! ||
isActionSetFolderAvailableOfflineOrSynchronize
isActionSetFolderAvailableOfflineOrSynchronize ||
// The etag does not always change when only share metadata changes.

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.

I think this comment could be removed since the method name is already descriptive enough 👍🏻


@Suppress("MaxLineLength")
@Test
fun `refreshFolder saves a folder child when the etag matches but share badges changed`() {

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.

To follow the naming convention of the other tests:

Suggested change
fun `refreshFolder saves a folder child when the etag matches but share badges changed`() {
fun `refreshFolder returns a list with the OCFile that changed when the etag matches but sharedByLink changed`() {


@Suppress("MaxLineLength")
@Test
fun `refreshFolder saves a folder child when the etag matches but share badges changed`() {

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.

What about the sharedWithSharee and permissions conditions? 🤔 We should create new tests for these, since they cover different scenarios. Do you agree? @jesmrec any comment about this?

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.

yep, that conditions are really unit, so they could be tested as unitary tests.

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.

[BUG] Sharing badges are not refreshing

3 participants