Disable 'Start New Chat' button in MemberInfo if we already have chats
Part of https://github.com/vector-im/riot-web/issues/10416pull/21833/head
parent
2ecabd2195
commit
3144b9f1a2
|
@ -789,6 +789,7 @@ module.exports = React.createClass({
|
||||||
let spinner;
|
let spinner;
|
||||||
|
|
||||||
if (this.props.member.userId !== this.context.matrixClient.credentials.userId) {
|
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);
|
const dmRoomMap = new DMRoomMap(this.context.matrixClient);
|
||||||
// dmRooms will not include dmRooms that we have been invited into but did not join.
|
// 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.
|
// 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_MemberInfo_createRoom_label: true,
|
||||||
mx_RoomTile_name: true,
|
mx_RoomTile_name: true,
|
||||||
});
|
});
|
||||||
const startNewChat = <AccessibleButton
|
let startNewChat = <AccessibleButton
|
||||||
className="mx_MemberInfo_createRoom"
|
className="mx_MemberInfo_createRoom"
|
||||||
onClick={this.onNewDMClick}
|
onClick={this.onNewDMClick}
|
||||||
>
|
>
|
||||||
|
@ -840,6 +841,8 @@ module.exports = React.createClass({
|
||||||
<div className={labelClasses}><i>{ _t("Start a chat") }</i></div>
|
<div className={labelClasses}><i>{ _t("Start a chat") }</i></div>
|
||||||
</AccessibleButton>;
|
</AccessibleButton>;
|
||||||
|
|
||||||
|
if (tiles.length > 0) startNewChat = null; // Don't offer a button for a new chat if we have one.
|
||||||
|
|
||||||
startChat = <div>
|
startChat = <div>
|
||||||
<h3>{ _t("Direct chats") }</h3>
|
<h3>{ _t("Direct chats") }</h3>
|
||||||
{ tiles }
|
{ tiles }
|
||||||
|
|
Loading…
Reference in New Issue