Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Allow to use basic html to format invite messages #6703

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/views/elements/InviteReason.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ limitations under the License.

import classNames from "classnames";
import React from "react";
import { sanitizedHtmlNode } from "../../../HtmlUtils";
import { _t } from "../../../languageHandler";
import { replaceableComponent } from "../../../utils/replaceableComponent";

interface IProps {
reason: string;
htmlReason?: string;
}

interface IState {
Expand Down Expand Up @@ -51,7 +53,7 @@ export default class InviteReason extends React.PureComponent<IProps, IState> {
});

return <div className={classes}>
<div className="mx_InviteReason_reason">{ this.props.reason }</div>
<div className="mx_InviteReason_reason">{ this.props.htmlReason ? sanitizedHtmlNode(this.props.htmlReason) : this.props.reason }</div>
<div className="mx_InviteReason_view"
onClick={this.onViewClick}
>
Expand Down
10 changes: 7 additions & 3 deletions src/components/views/rooms/RoomPreviewBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,13 @@ export default class RoomPreviewBar extends React.Component {
}

const myUserId = MatrixClientPeg.get().getUserId();
const reason = this.props.room.currentState.getMember(myUserId).events.member.event.content.reason;
if (reason) {
reasonElement = <InviteReason reason={reason} />;
const memberEventContent = this.props.room.currentState.getMember(myUserId).events.member.event.content;
skolmer marked this conversation as resolved.
Show resolved Hide resolved

if (memberEventContent.reason) {
reasonElement = <InviteReason
reason={memberEventContent.reason}
htmlReason={memberEventContent["io.element.html_reason"]}
skolmer marked this conversation as resolved.
Show resolved Hide resolved
/>;
}

primaryActionHandler = this.props.onJoinClick;
Expand Down