diff --git a/src/components/views/messages/TextualBody.tsx b/src/components/views/messages/TextualBody.tsx index dc7cc4dc23d..1bfc05505e0 100644 --- a/src/components/views/messages/TextualBody.tsx +++ b/src/components/views/messages/TextualBody.tsx @@ -92,8 +92,11 @@ export default class TextualBody extends React.Component { const showLineNumbers = SettingsStore.getValue("showCodeLineNumbers"); this.activateSpoilers([content]); - HtmlUtils.linkifyElement(content); + // pillifyLinks BEFORE linkifyElement because plain room/user URLs in the composer + // are still sent as plaintext URLs. If these are ever pillified in the composer, + // we should be pillify them here by doing the linkifying BEFORE the pillifying. pillifyLinks([content], this.props.mxEvent, this.pills); + HtmlUtils.linkifyElement(content); this.calculateUrlPreview(); diff --git a/test/components/views/messages/TextualBody-test.tsx b/test/components/views/messages/TextualBody-test.tsx index 149cb7ae475..f5466c46cfe 100644 --- a/test/components/views/messages/TextualBody-test.tsx +++ b/test/components/views/messages/TextualBody-test.tsx @@ -147,21 +147,21 @@ describe("", () => { ); }); - it("pillification of MXIDs get applied correctly into the DOM", () => { + it("should not pillify MXIDs", () => { const ev = mkRoomTextMessage("Chat with @user:example.com"); const { container } = getComponent({ mxEvent: ev }); const content = container.querySelector(".mx_EventTile_body"); expect(content.innerHTML).toMatchInlineSnapshot( - `"Chat with Member"`, + `"Chat with @user:example.com"`, ); }); - it("pillification of room aliases get applied correctly into the DOM", () => { + it("should not pillify room aliases", () => { const ev = mkRoomTextMessage("Visit #room:example.com"); const { container } = getComponent({ mxEvent: ev }); const content = container.querySelector(".mx_EventTile_body"); expect(content.innerHTML).toMatchInlineSnapshot( - `"Visit #room:example.com"`, + `"Visit #room:example.com"`, ); }); });