55 * @author Jorge Aguado Recio
66 * @author Aitor Ballesteros Pavón
77 *
8- * Copyright (C) 2025 ownCloud GmbH.
8+ * Copyright (C) 2026 ownCloud GmbH.
99 *
1010 * This program is free software: you can redistribute it and/or modify
1111 * it under the terms of the GNU General Public License version 2,
@@ -94,6 +94,7 @@ class SpacesListFragment :
9494 private var userPermissions = mutableSetOf<UserPermissions >()
9595 private var editQuotaPermission = false
9696 private var selectedImagePath: String? = null
97+ private var accountId: String? = null
9798 private lateinit var currentSpace: OCSpace
9899
99100 private val spacesListViewModel: SpacesListViewModel by viewModel {
@@ -205,7 +206,10 @@ class SpacesListFragment :
205206 when (val uiResult = event.peekContent()) {
206207 is UIResult .Success -> {
207208 Timber .d(" The account id for $accountName is: ${uiResult.data} " )
208- uiResult.data?.let { spacesListViewModel.getUserPermissions(it) }
209+ uiResult.data?.let {
210+ accountId = it
211+ spacesListViewModel.getUserPermissions(it)
212+ }
209213 }
210214 is UIResult .Loading -> { }
211215 is UIResult .Error -> {
@@ -231,6 +235,7 @@ class SpacesListFragment :
231235 is UIResult .Loading -> { }
232236 is UIResult .Error -> {
233237 Timber .e(uiResult.error, " Failed to retrieve user permissions for account $accountName " )
238+ userPermissions.clear()
234239 binding.fabCreateSpace.isVisible = false
235240 }
236241 }
@@ -304,6 +309,7 @@ class SpacesListFragment :
304309
305310 override fun onThreeDotButtonClick (ocSpace : OCSpace ) {
306311 currentSpace = ocSpace
312+ accountId?.let { spacesListViewModel.getUserPermissions(it) }
307313 spacesListViewModel.filterMenuOptions(ocSpace, userPermissions)
308314 }
309315
0 commit comments