Suggest @room when @channel, @everyone, or @here is typed in composer (#6529)

Signed-off-by: Prat T <pt2121@users.noreply.github.com>
This commit is contained in:
Prat T 2022-09-03 17:26:45 -07:00
parent bddb37ef7a
commit 6917e97f49
No known key found for this signature in database
GPG Key ID: 288BA40A64BD3461
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")
}
}