Allow to use basic html formatting in invite reasons
This commit is contained in:
parent
9d9f590c21
commit
6da11f375d
2 changed files with 7 additions and 4 deletions
|
@ -16,11 +16,13 @@ limitations under the License.
|
||||||
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { sanitizedHtmlNode } from "../../../HtmlUtils";
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
reason: string;
|
reason: string;
|
||||||
|
htmlReason?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
@ -51,7 +53,7 @@ export default class InviteReason extends React.PureComponent<IProps, IState> {
|
||||||
});
|
});
|
||||||
|
|
||||||
return <div className={classes}>
|
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"
|
<div className="mx_InviteReason_view"
|
||||||
onClick={this.onViewClick}
|
onClick={this.onViewClick}
|
||||||
>
|
>
|
||||||
|
|
|
@ -492,9 +492,10 @@ export default class RoomPreviewBar extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const myUserId = MatrixClientPeg.get().getUserId();
|
const myUserId = MatrixClientPeg.get().getUserId();
|
||||||
const reason = this.props.room.currentState.getMember(myUserId).events.member.event.content.reason;
|
const memberEventContent = this.props.room.currentState.getMember(myUserId).events.member.event.content;
|
||||||
if (reason) {
|
|
||||||
reasonElement = <InviteReason reason={reason} />;
|
if (memberEventContent.reason) {
|
||||||
|
reasonElement = <InviteReason reason={memberEventContent.reason} htmlReason={memberEventContent["io.element.html_reason"]} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
primaryActionHandler = this.props.onJoinClick;
|
primaryActionHandler = this.props.onJoinClick;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue