Escape @room in reply fallback to avoid unintentional pings
Closes https://github.com/SchildiChat/SchildiChat-android/issues/178 Change-Id: I8a545dd80d29802d1b35b0315fca89125c997f15
This commit is contained in:
parent
e875b0d731
commit
80edce3d6c
@ -34,6 +34,7 @@ Here you can find some extra features and changes compared to Element Android (w
|
|||||||
- Render image reactions
|
- Render image reactions
|
||||||
- Send freeform reactions
|
- Send freeform reactions
|
||||||
- Render media captions ([MSC2530](https://github.com/matrix-org/matrix-spec-proposals/pull/2530))
|
- Render media captions ([MSC2530](https://github.com/matrix-org/matrix-spec-proposals/pull/2530))
|
||||||
|
- Escape @room in the reply fallback to avoid unintentional room pings when replying
|
||||||
|
|
||||||
- Branding (name, app icon, links)
|
- Branding (name, app icon, links)
|
||||||
- Show a toast instead of a snackbar after copying text, in order to not block the input area right after copying
|
- Show a toast instead of a snackbar after copying text, in order to not block the input area right after copying
|
||||||
|
@ -637,7 +637,7 @@ internal class LocalEchoEventFactory @Inject constructor(
|
|||||||
permalink,
|
permalink,
|
||||||
userLink,
|
userLink,
|
||||||
userId,
|
userId,
|
||||||
bodyFormatted,
|
bodyFormatted.escapeRoomPings(),
|
||||||
finalReplyTextFormatted
|
finalReplyTextFormatted
|
||||||
)
|
)
|
||||||
//
|
//
|
||||||
@ -726,7 +726,7 @@ internal class LocalEchoEventFactory @Inject constructor(
|
|||||||
append(originalSenderId)
|
append(originalSenderId)
|
||||||
append(">")
|
append(">")
|
||||||
|
|
||||||
val lines = body.text.split("\n")
|
val lines = body.text.escapeRoomPings().split("\n")
|
||||||
lines.forEachIndexed { index, s ->
|
lines.forEachIndexed { index, s ->
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
append(" $s")
|
append(" $s")
|
||||||
@ -739,6 +739,11 @@ internal class LocalEchoEventFactory @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.escapeRoomPings(): String {
|
||||||
|
// Escape @room, so replying as moderator will not ping the whole room
|
||||||
|
return replace("@room", "@\u2060room")
|
||||||
|
}
|
||||||
|
|
||||||
private fun bodyForReply(timelineEvent: TimelineEvent, isRedactedEvent: Boolean = false): TextContent {
|
private fun bodyForReply(timelineEvent: TimelineEvent, isRedactedEvent: Boolean = false): TextContent {
|
||||||
val content = when (timelineEvent.root.getClearType()) {
|
val content = when (timelineEvent.root.getClearType()) {
|
||||||
in EventType.POLL_END.values -> {
|
in EventType.POLL_END.values -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user