Skip to content

Commit 29fb60e

Browse files
authored
Merge pull request #3643 from owncloud/feature/user_list_sharing
Removed signed in user from the list of users for sharing
2 parents 69bb781 + e2bf38f commit 29fb60e

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Summary
1111
* Bugfix - Security flags for recording screen: [#3468](https://github.com/owncloud/android/issues/3468)
1212
* Bugfix - Crash when changing orientation in Details view: [#3571](https://github.com/owncloud/android/issues/3571)
1313
* Bugfix - Lock displays shown again: [#3591](https://github.com/owncloud/android/issues/3591)
14+
* Bugfix - Prevented signed in user in the list of users to be shared: [#1419](https://github.com/owncloud/android/issues/1419)
1415
* Enhancement - First steps in Android Enterprise integration: [#3415](https://github.com/owncloud/android/issues/3415)
1516
* Enhancement - Lock delay enforced: [#3440](https://github.com/owncloud/android/issues/3440)
1617
* Enhancement - Provide app feedback to MDM admins: [#3420](https://github.com/owncloud/android/issues/3420)
@@ -55,6 +56,14 @@ Details
5556
https://github.com/owncloud/android/issues/3591
5657
https://github.com/owncloud/android/pull/3592
5758

59+
* Bugfix - Prevented signed in user in the list of users to be shared: [#1419](https://github.com/owncloud/android/issues/1419)
60+
61+
Previously, user list for sharing contains signed in user, now this user is omitted to avoid
62+
errors.
63+
64+
https://github.com/owncloud/android/issues/1419
65+
https://github.com/owncloud/android/pull/3643
66+
5867
* Enhancement - First steps in Android Enterprise integration: [#3415](https://github.com/owncloud/android/issues/3415)
5968

6069
Two parameters (server url and server url input visibility) can be now managed via MDM. These

changelog/unreleased/3643

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Bugfix: Prevented signed in user in the list of users to be shared
2+
3+
Previously, user list for sharing contains signed in user,
4+
now this user is omitted to avoid errors.
5+
6+
https://github.com/owncloud/android/issues/1419
7+
https://github.com/owncloud/android/pull/3643

owncloudApp/src/main/java/com/owncloud/android/presentation/providers/sharing/UsersAndGroupsSearchProvider.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
package com.owncloud.android.presentation.providers.sharing
2626

27+
import android.accounts.AccountManager
2728
import android.app.SearchManager
2829
import android.content.ContentProvider
2930
import android.content.ContentValues
@@ -43,10 +44,10 @@ import com.owncloud.android.domain.sharing.sharees.GetShareesAsyncUseCase
4344
import com.owncloud.android.domain.sharing.sharees.model.OCSharee
4445
import com.owncloud.android.domain.sharing.shares.model.ShareType
4546
import com.owncloud.android.extensions.parseError
47+
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_DISPLAY_NAME
4648
import org.json.JSONException
4749
import org.koin.android.ext.android.inject
4850
import timber.log.Timber
49-
import java.util.HashMap
5051
import java.util.Locale
5152

5253
/**
@@ -178,8 +179,13 @@ class UsersAndGroupsSearchProvider : ContentProvider() {
178179
val federatedShareAllowed = capabilities?.filesSharingFederationOutgoing?.isTrue ?: false
179180

180181
try {
182+
val userName = AccountUtils.getUsernameOfAccount(account.name)
183+
val fullName = AccountManager.get(context).getUserData(account, KEY_DISPLAY_NAME)
181184
while (namesIt.hasNext()) {
182185
item = namesIt.next()
186+
if (item.label == userName || item.label == fullName && item.shareType == ShareType.USER) {
187+
continue
188+
}
183189
var userName = item.label
184190
val type = item.shareType
185191
val shareWith = item.shareWith

0 commit comments

Comments
 (0)