Skip to content

Commit 5027e36

Browse files
authored
Merge pull request #4750 from owncloud/fix/edit_space_without_connection
[FIX] Edit space option available with no connection
2 parents af6c34b + c18001b commit 5027e36

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ ownCloud admins and users.
4040

4141
## Summary
4242

43+
* Bugfix - Edit space option available when there is no connection: [#4742](https://github.com/owncloud/android/issues/4742)
4344
* Change - Migrate tests to the new kotlinx-coroutines-test API: [#4710](https://github.com/owncloud/android/issues/4710)
4445
* Change - Increase rating dialog delay: [#4744](https://github.com/owncloud/android/pull/4744)
4546
* Enhancement - Show members of a space: [#4612](https://github.com/owncloud/android/issues/4612)
@@ -48,6 +49,14 @@ ownCloud admins and users.
4849

4950
## Details
5051

52+
* Bugfix - Edit space option available when there is no connection: [#4742](https://github.com/owncloud/android/issues/4742)
53+
54+
A new condition has been added to hide the edit space option when no network
55+
connection is available.
56+
57+
https://github.com/owncloud/android/issues/4742
58+
https://github.com/owncloud/android/pull/4750
59+
5160
* Change - Migrate tests to the new kotlinx-coroutines-test API: [#4710](https://github.com/owncloud/android/issues/4710)
5261

5362
Some tests from view model classes have been refactored in order to use the new

‎changelog/unreleased/4750‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: Edit space option available when there is no connection
2+
3+
A new condition has been added to hide the edit space option when no network connection is available.
4+
5+
https://github.com/owncloud/android/issues/4742
6+
https://github.com/owncloud/android/pull/4750

‎owncloudApp/src/main/java/com/owncloud/android/presentation/spaces/SpacesListFragment.kt‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
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

‎owncloudDomain/src/main/java/com/owncloud/android/domain/spaces/usecases/FilterSpaceMenuOptionsUseCase.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @author Jorge Aguado Recio
55
*
6-
* Copyright (C) 2025 ownCloud GmbH.
6+
* Copyright (C) 2026 ownCloud GmbH.
77
*
88
* This program is free software: you can redistribute it and/or modify
99
* it under the terms of the GNU General Public License version 2,
@@ -49,7 +49,7 @@ class FilterSpaceMenuOptionsUseCase(
4949
optionsToShow.add(SpaceMenuOption.MEMBERS)
5050
}
5151

52-
if (editPermission || isSpaceManager) {
52+
if (editPermission || (isSpaceManager && currentSpace.isDisabled)) {
5353
optionsToShow.add(SpaceMenuOption.EDIT)
5454
}
5555

0 commit comments

Comments
 (0)