Adding header section only when "@room" is available

This commit is contained in:
Maxime Naturel 2022-02-17 14:14:44 +01:00
parent 11dacbab81
commit df3fc38054
1 changed files with 5 additions and 1 deletions

View File

@ -85,10 +85,14 @@ class AutocompleteMemberPresenter @AssistedInject constructor(context: Context,
val membersHeader = createMembersHeader() val membersHeader = createMembersHeader()
val members = createMemberItems(queryParams) val members = createMemberItems(queryParams)
val everyone = createEveryoneItem(query) val everyone = createEveryoneItem(query)
// add headers only when user can notify everyone
val canAddHeaders = canNotifyEveryone()
val items = mutableListOf<AutocompleteMemberItem>().apply { val items = mutableListOf<AutocompleteMemberItem>().apply {
if (members.isNotEmpty()) { if (members.isNotEmpty()) {
add(membersHeader) if (canAddHeaders) {
add(membersHeader)
}
addAll(members) addAll(members)
} }
everyone?.let { everyone?.let {