Merge pull request #7000 from pt2121/pt/6529-room

Suggest @room when @channel, @everyone, or @here is typed in composer
This commit is contained in:
Benoit Marty 2022-09-07 15:49:18 +02:00 committed by GitHub
commit 59e6fa98c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

1
changelog.d/6529.feature Normal file
View File

@ -0,0 +1 @@
Suggest @room when @channel, @everyone, or @here is typed in composer

View File

@ -145,7 +145,12 @@ class AutocompleteMemberPresenter @AssistedInject constructor(
private fun createEveryoneItem(query: CharSequence?) =
room.roomSummary()
?.takeIf { canNotifyEveryone() }
?.takeIf { query.isNullOrBlank() || MatrixItem.NOTIFY_EVERYONE.startsWith("@$query") }
?.takeIf {
query.isNullOrBlank() ||
SUGGEST_ROOM_KEYWORDS.any {
it.startsWith("@$query")
}
}
?.let {
AutocompleteMemberItem.Everyone(it)
}
@ -165,6 +170,7 @@ class AutocompleteMemberPresenter @AssistedInject constructor(
companion object {
private const val ID_HEADER_MEMBERS = "ID_HEADER_MEMBERS"
private const val ID_HEADER_EVERYONE = "ID_HEADER_EVERYONE"
private val SUGGEST_ROOM_KEYWORDS = setOf(MatrixItem.NOTIFY_EVERYONE, "@channel", "@everyone", "@here")
}
}