Skip to content

BugFix - External Share Icon Appreance After Delete #15153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alperozturk96
Copy link
Collaborator

@alperozturk96 alperozturk96 commented Jul 14, 2025

  • Tests written, or not not needed

Steps to Reproduce:

  1. Launch the app and log in.
  2. Tap the share icon on any file or folder.
  3. Enter an external email address and create share. Return to the file list and observe the share icon.
  4. Delete the external share from the share detail screen and observe the share icon again.

Actual Result:

The share icon sometimes continues to display the "shared" state, or doesn't update at all even after a hard refresh.

Expected Result:

After deleting the share, the icon should return to its default (unshared) state consistently.

@alperozturk96 alperozturk96 added this to the Nextcloud App 3.32.2 milestone Jul 14, 2025
@alperozturk96
Copy link
Collaborator Author

/backport to stable-3.32

@@ -650,6 +651,12 @@ public void sendNewEmail(OCShare share) {
public void unShare(OCShare share) {
unShareWith(share);

FileEntity entity = fileDataStorageManager.getFileEntity(file);
if (entity != null) {
entity.setSharedWithSharee(0);
Copy link
Member

Choose a reason for hiding this comment

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

Not tried it, but what if you have like this

  • file with two sharees, e.g. share via mail and to user1
  • unshare one of them
    --> then this is triggered and set to false?
    Then it will not show the sharees?

if ((file.isSharedWithMe() || file.isSharedWithSharee()) && !isMultiSelect() && !gridView &&

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the feedback.

Since we are using ShareeListAdapter for both internal and external shares, and the fields sharedWithSharee and sharedViaLink are used as boolean indicators rather than actual share counts (where 1 represents that a share exists and 0 means no shares), we can simplify the logic.

After removing a share, we can check whether the corresponding adapter (sharesListInternal or sharesListExternal) is empty. If so, we can safely set sharedWithSharee or sharedViaLink to 0 to indicate that there are no remaining shares of that type.

tobiasKaminsky

This comment was marked as resolved.

@alperozturk96 alperozturk96 force-pushed the bugfix/external-share-icon-appreance-after-delete branch 2 times, most recently from a89b7e0 to 4b7d49b Compare July 22, 2025 12:49
…r returning back from the file details

Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
Signed-off-by: alperozturk <[email protected]>
@alperozturk96 alperozturk96 force-pushed the bugfix/external-share-icon-appreance-after-delete branch from 4b7d49b to c4e1865 Compare July 23, 2025 14:30
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15153.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

Copy link

Copy link

Codacy

Lint

TypemasterPR
Warnings4848
Errors1111

SpotBugs

CategoryBaseNew
Bad practice6262
Correctness6161
Dodgy code299299
Experimental11
Internationalization77
Malicious code vulnerability22
Multithreaded correctness3535
Performance4848
Security1818
Total533533

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