import { MatrixClient, MatrixEvent } from 'matrix-js-sdk'; import { getEditedEvent, trimReplyFromBody, trimReplyFromFormattedBody } from '../../../utils/room'; import { decryptFile, downloadEncryptedMedia, mxcUrlToHttp } from '../../../utils/matrix'; import { FALLBACK_MIMETYPE } from '../../../utils/mimeTypes'; import { IEncryptedFile } from '../../../../types/matrix/common'; /** * Build the content to forward: * - undecryptable events are refused (would forward `m.bad.encrypted` junk) * - edited messages forward the LATEST edit (`m.new_content`), not the * original pre-edit body * - reply fallbacks (`> <@user> …` quote + `` block) are stripped * along with the `m.relates_to` reply/thread relation, so the forwarded * message stands alone in the target room */ /** * Provenance stamped onto a forwarded event so the receiving client can show * "Forwarded from in ·