Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
circles-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Circles
circles-android
Commits
cdd60463
Commit
cdd60463
authored
1 year ago
by
Taras
Browse files
Options
Downloads
Patches
Plain Diff
Filter ignored users from people tab
parent
7d70bf51
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/org/futo/circles/feature/people/PeopleDataSource.kt
+12
-3
12 additions, 3 deletions
.../java/org/futo/circles/feature/people/PeopleDataSource.kt
with
12 additions
and
3 deletions
app/src/main/java/org/futo/circles/feature/people/PeopleDataSource.kt
+
12
−
3
View file @
cdd60463
...
...
@@ -45,25 +45,34 @@ class PeopleDataSource @Inject constructor(
suspend
fun
getPeopleList
(
query
:
String
)
=
combine
(
searchUserDataSource
.
searchKnownUsers
(
query
),
searchUserDataSource
.
searchSuggestions
(
query
),
getIgnoredUserFlow
(),
getProfileRoomMembersKnockFlow
()
)
{
knowUsers
,
suggestions
,
requests
->
withContext
(
Dispatchers
.
IO
)
{
buildList
(
knowUsers
,
suggestions
,
requests
)
}
)
{
knowUsers
,
suggestions
,
ignoredUsers
,
requests
->
withContext
(
Dispatchers
.
IO
)
{
buildList
(
knowUsers
,
suggestions
,
ignoredUsers
,
requests
)
}
}.
distinctUntilChanged
()
suspend
fun
refreshRoomMembers
()
{
searchUserDataSource
.
loadAllRoomMembersIfNeeded
()
}
private
fun
getIgnoredUserFlow
()
=
session
?.
userService
()
?.
getIgnoredUsersLive
()
?.
asFlow
()
?:
flowOf
()
private
fun
buildList
(
knowUsers
:
List
<
User
>,
suggestions
:
List
<
User
>,
ignoredUsers
:
List
<
User
>,
requests
:
List
<
KnockRequestListItem
>
):
List
<
PeopleListItem
>
{
val
ignoredUsersIds
=
ignoredUsers
.
map
{
it
.
userId
}.
toSet
()
val
uniqueItemsList
=
mutableListOf
<
PeopleListItem
>().
apply
{
addAll
(
requests
.
map
{
it
.
toPeopleRequestListItem
()
})
addAll
(
knowUsers
.
map
{
it
.
toPeopleUserListItem
(
getKnownUserItemType
(
it
.
userId
))
})
addAll
(
suggestions
.
map
{
it
.
toPeopleUserListItem
(
PeopleItemType
.
Suggestion
)
})
}.
distinctBy
{
it
.
id
}.
filterNot
{
it
.
id
==
session
?.
myUserId
}
}
.
distinctBy
{
it
.
id
}
.
filterNot
{
it
.
id
==
session
?.
myUserId
||
ignoredUsersIds
.
contains
(
it
.
id
)
}
return
mutableListOf
<
PeopleListItem
>().
apply
{
addSection
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment