Skip to content

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

Merged
jesmrec merged 6 commits into
owncloud:masterfrom
mvanhorn:fix/4938-oc10-sharing-badges-refresh
Nov 3, 2026
Merged

jesmrec merged 6 commits into
owncloud:masterfrom
mvanhorn:fix/4938-oc10-sharing-badges-refresh

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Oct 12, 2026 •

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.

@mvanhorn
mvanhorn requested a review from a team as a code owner October 12, 2026 09:46

@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 Resolved
@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!

@mvanhorn

Copy link
Copy Markdown
Contributor Author

Pushed two small follow-ups for the second round: 2cd2b3b drops the redundant comment in OCFileRepository, and 946f942 renames the test to match the naming convention. I added them as separate commits so the diff is easy to check. Glad to squash them into the existing commits if you prefer.

The extra unit tests for the sharedWithSharee and permissions conditions are not in this push yet. There is no JDK on the machine I used, so neither change was built or run; ktlint reports no new findings on either file.

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

Good job @mvanhorn! LGTM! 💯 Let's move it to QA

@jesmrec

jesmrec commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Some QA checks:

  • oCIS Personal

    • Root folder: add first link in web and refresh -> link badge in app
    • Root folder: add first share in web and refresh -> share badge in app
    • Root folder: remove last link in web and refresh -> link badge not in app
    • Root folder: remove last share in web and refresh -> share badge not in app
    • Non-Root folder: add first link in web and refresh -> link badge in app
    • Non-Root folder: add first share in web and refresh -> share badge in app
    • Non-Root folder: remove last link in web and refresh -> link badge not in app
    • Non-Root folder: remove last share in web and refresh -> share badge not in app
  • oCIS Custom space

    • Root folder: add first link in web and refresh -> link badge in app
    • Root folder: add first share in web and refresh -> share badge in app
    • Root folder: remove last link in web and refresh -> link badge not in app
    • Root folder: remove last share in web and refresh -> share badge not in app
    • Non-Root folder: add first link in web and refresh -> link badge in app
    • Non-Root folder: add first share in web and refresh -> share badge in app
    • Non-Root folder: remove last link in web and refresh -> link badge not in app
    • Non-Root folder: remove last share in web and refresh -> share badge not in app
  • oC10

    • Root folder: add first link in web and refresh -> link badge in app
    • Root folder: add first share in web and refresh -> share badge in app
    • Root folder: remove last link in web and refresh -> link badge not in app
    • Root folder: remove last share in web and refresh -> share badge not in app
    • Non-Root folder: add first link in web and refresh -> link badge in app
    • Non-Root folder: add first share in web and refresh -> share badge in app
    • Non-Root folder: remove last link in web and refresh -> link badge not in app
    • Non-Root folder: remove last share in web and refresh -> share badge not in app

@jesmrec

jesmrec commented Nov 3, 2026

Copy link
Copy Markdown
Member

@mvanhorn your contribution is also QA-approved, congrats!!

Please, rebase the branch against master and it will be merged.

Thanks a lot for your engagement! 🚀

mvanhorn and others added 6 commits November 3, 2026 13:30
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
Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
@mvanhorn

mvanhorn commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @jesmrec and @joragua! Rebased onto master in f296359. OCFileRepositoryTest still passes, all 69 tests.

@mvanhorn
mvanhorn force-pushed the fix/4938-oc10-sharing-badges-refresh branch from 7112e1c to f296359 Compare November 3, 2026 21:31
@jesmrec
jesmrec merged commit 2a327d5 into owncloud:master Nov 3, 2026
8 checks passed
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