Implement broadcast message preview (#9762)
This commit is contained in:
parent
6205c70462
commit
51554399fb
15 changed files with 353 additions and 32 deletions
|
@ -23,11 +23,15 @@ import { _t, sanitizeForTranslation } from "../../../languageHandler";
|
|||
import { getSenderName, isSelf, shouldPrefixMessagesIn } from "./utils";
|
||||
import { getHtmlText } from "../../../HtmlUtils";
|
||||
import { stripHTMLReply, stripPlainReply } from "../../../utils/Reply";
|
||||
import { VoiceBroadcastChunkEventType } from "../../../voice-broadcast/types";
|
||||
|
||||
export class MessageEventPreview implements IPreview {
|
||||
public getTextFor(event: MatrixEvent, tagId?: TagID, isThread?: boolean): string {
|
||||
public getTextFor(event: MatrixEvent, tagId?: TagID, isThread?: boolean): string | null {
|
||||
let eventContent = event.getContent();
|
||||
|
||||
// no preview for broadcast chunks
|
||||
if (eventContent[VoiceBroadcastChunkEventType]) return null;
|
||||
|
||||
if (event.isRelation(RelationType.Replace)) {
|
||||
// It's an edit, generate the preview on the new text
|
||||
eventContent = event.getContent()["m.new_content"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue