clarify why its always safe to not append @room at end while parsing
parent
d9e62b54fc
commit
47579f37e8
|
@ -27,6 +27,9 @@ function parseAtRoomMentions(text, partCreator) {
|
||||||
if (textPart.length) {
|
if (textPart.length) {
|
||||||
parts.push(partCreator.plain(textPart));
|
parts.push(partCreator.plain(textPart));
|
||||||
}
|
}
|
||||||
|
// it's safe to never append @room after the last text
|
||||||
|
// as split will report an empty string at the end if
|
||||||
|
// `text` ended in @room.
|
||||||
const isLast = i === arr.length - 1;
|
const isLast = i === arr.length - 1;
|
||||||
if (!isLast) {
|
if (!isLast) {
|
||||||
parts.push(partCreator.atRoomPill(ATROOM));
|
parts.push(partCreator.atRoomPill(ATROOM));
|
||||||
|
|
Loading…
Reference in New Issue