Skip to content

Commit

Permalink
Merge pull request #7000 from pt2121/pt/6529-room
Browse files Browse the repository at this point in the history
Suggest @room when @channel, @everyone, or @here is typed in composer
  • Loading branch information
bmarty authored Sep 7, 2022
2 parents bdfbbbb + 6917e97 commit 59e6fa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/6529.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Suggest @room when @channel, @everyone, or @here is typed in composer
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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")
}
}

Expand Down

0 comments on commit 59e6fa9

Please sign in to comment.