Skip to content

feat: create a share with users and groups on an oCIS server - #4952

Open
joragua wants to merge 6 commits into
masterfrom
feature/create_file_share
Open

feat: create a share with users and groups on an oCIS server#4952
joragua wants to merge 6 commits into
masterfrom
feature/create_file_share

Conversation

@joragua

@joragua joragua commented Aug 10, 2026

Copy link
Copy Markdown
Member

Related Issues

App: #4875 #4917

  • 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

Reports:

@joragua joragua self-assigned this Aug 10, 2026
@joragua joragua linked an issue Aug 10, 2026 that may be closed by this pull request
12 tasks
@joragua
joragua force-pushed the feature/create_file_share branch 2 times, most recently from 20ec770 to 102a12c Compare August 13, 2026 10:13
@joragua joragua linked an issue Aug 25, 2026 that may be closed by this pull request
@joragua
joragua force-pushed the feature/create_file_share branch 2 times, most recently from c31b4bd to 04ce872 Compare August 25, 2026 14:30
@joragua
joragua marked this pull request as ready for review August 25, 2026 15:22
@joragua
joragua requested a review from a team as a code owner August 25, 2026 15:22
@joragua joragua changed the title feat: enable + button when user has sharing permission feat: create an oCIS share with users and groups Aug 26, 2026
Comment thread changelog/unreleased/4952 Outdated
Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
… oCIS server

Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
…aSourceTest

Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
@joragua
joragua force-pushed the feature/create_file_share branch from 04ce872 to dc199d3 Compare August 27, 2026 11:45
…ated code

Signed-off-by: Jorge Aguado Recio <jaguado@izertis.com>
@joragua
joragua requested a review from jesmrec August 27, 2026 12:12
@joragua joragua changed the title feat: create an oCIS share with users and groups feat: create a share with users and groups on an oCIS server Aug 27, 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.

Cool, great job @joragua!

Let's move this to QA

@jesmrec

jesmrec commented Sep 2, 2026

Copy link
Copy Markdown
Member

(1)

  1. Enable Talkback
  2. Open Share and click on +

Current: Talkback says Add new member

Expected: Share with people

Xiaomi Redmi 13, Android 15
3b3534cf2

@jesmrec

jesmrec commented Sep 4, 2026

Copy link
Copy Markdown
Member

(2)

That one comes from the 1st draft of the E2E tests for sharing NG.

After selecting the sharee, sometimes, the list of permissions is not loaded. I wasn't able to reproduce in a real device, but, it might be caused because the automatic way is faster in performing requests. Check the following video:

Screen_recording_20260904_100347-edit.mp4

is there something that could be improved there?

PD: i asked claude and it said that:

Root Cause

  Race condition in AddGraphShareFragment.subscribeToViewModels() (lines 122–124):

  val currentPermissions = (graphShareViewModel.shares.value?.peekContent() as? UIResult.Success)?.data
  roles = currentPermissions?.roles ?: emptyList()

  This reads shares.value synchronously as a one-time snapshot. The flow is:

  1. GraphShareFragment triggers getGraphShares() only after getRolesAsyncUseCase succeeds (see observeRoles() line 119).
  2. When a human taps "Add member", both roles and shares have already loaded → snapshot is non-null → works.
  3. When an automated test navigates faster, AddGraphShareFragment is created before the network call for shares finishes → shares.value is null → roles = emptyList().

  The fragment never subscribes to graphShareViewModel.roles or .shares to reactively update rolesAdapter once the data arrives. The list stays empty forever.

  Secondary bug: SpaceRolesAdapter.setRoles() (line 86–88) and setSelectedRole() (line 90–92) don't call notifyDataSetChanged(), so even if the data were set later, the RecyclerView would not redraw.

and that was the suggested change in AddGraphShareFragment.kt

      142 +        collectLatestLifecycleFlow(graphShareViewModel.roles) { event ->                                                                                                                                                             
      143 +            event?.let {                                                                                                                                                                                                             
      144 +                when (val uiResult = event.peekContent()) {                                                                                                                                                                          
      145 +                    is UIResult.Success -> {                                                                                                                                                                                         
      146 +                        uiResult.data?.let { fetchedRoles ->                                                                                                                                                                         
      147 +                            roles = fetchedRoles                                                                                                                                                                                     
      148 +                            rolesAdapter.setRoles(roles)                                                                                                                                                                             
      149 +                        }                                                                                                                                                                                                            
      150 +                    }                                                                                                                                                                                                                
      151 +                    is UIResult.Loading -> { }                                                                                                                                                                                       
      152 +                    is UIResult.Error -> Timber.e(uiResult.error, "Failed to retrieve platform roles")                                                                                                                               
      153 +                }                                                                                                                                                                                                                    
      154 +            }                                                                                                                                                                                                                        
      155 +        } 

and in SpaceRolesAdapter.kt

      86      fun setRoles(roles: List<OCRole>) {
      87          this.roles = roles
      88 +        notifyDataSetChanged()                                                                                                                                                                                                        
      89      }
      90  
      91      fun setSelectedRole(id: String) {
      92 +        val previousId = selectedRoleId                                                                                                                                                                                               
      93          this.selectedRoleId = id
      94 +        previousId?.let { notifyItemChanged(roles.indexOfFirst { it.id == previousId }) }                                                                                                                                             
      95 +        notifyItemChanged(roles.indexOfFirst { it.id == id })                                                                                                                                                                         
      96      }
      97 

in case it works, should it be added to the refactor for space management?

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] Sharing NG: create share with user/group [BUG] Expiration date is slightly cut

2 participants