Disable 'Start New Chat' button in MemberInfo if we already have chats

Part of https://github.com/vector-im/riot-web/issues/10416
This commit is contained in:
Travis Ralston 2019-08-07 12:06:27 -06:00
parent 2ecabd2195
commit 3144b9f1a2

View File

@ -789,6 +789,7 @@ module.exports = React.createClass({
let spinner;
if (this.props.member.userId !== this.context.matrixClient.credentials.userId) {
// TODO: Immutable DMs replaces a lot of this
const dmRoomMap = new DMRoomMap(this.context.matrixClient);
// dmRooms will not include dmRooms that we have been invited into but did not join.
// Because DMRoomMap runs off account_data[m.direct] which is only set on join of dm room.
@ -830,7 +831,7 @@ module.exports = React.createClass({
mx_MemberInfo_createRoom_label: true,
mx_RoomTile_name: true,
});
const startNewChat = <AccessibleButton
let startNewChat = <AccessibleButton
className="mx_MemberInfo_createRoom"
onClick={this.onNewDMClick}
>
@ -840,6 +841,8 @@ module.exports = React.createClass({
<div className={labelClasses}><i>{ _t("Start a chat") }</i></div>
</AccessibleButton>;
if (tiles.length > 0) startNewChat = null; // Don't offer a button for a new chat if we have one.
startChat = <div>
<h3>{ _t("Direct chats") }</h3>
{ tiles }