From 6917e97f49c98189aca03642aace85323b66ae52 Mon Sep 17 00:00:00 2001 From: Prat T Date: Sat, 3 Sep 2022 17:26:45 -0700 Subject: [PATCH] Suggest @room when @channel, @everyone, or @here is typed in composer (#6529) Signed-off-by: Prat T --- changelog.d/6529.feature | 1 + .../autocomplete/member/AutocompleteMemberPresenter.kt | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changelog.d/6529.feature diff --git a/changelog.d/6529.feature b/changelog.d/6529.feature new file mode 100644 index 0000000000..dc51d1dad0 --- /dev/null +++ b/changelog.d/6529.feature @@ -0,0 +1 @@ +Suggest @room when @channel, @everyone, or @here is typed in composer \ No newline at end of file diff --git a/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt b/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt index a480b1c279..ff04a4db17 100644 --- a/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt +++ b/vector/src/main/java/im/vector/app/features/autocomplete/member/AutocompleteMemberPresenter.kt @@ -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") } }