;
}
if (this.props.saving) {
const Spinner = sdk.getComponent("elements.Spinner");
spinner =
;
}
if (canSetRoomName) {
const RoomNameEditor = sdk.getComponent("rooms.RoomNameEditor");
name = ;
} else {
// don't display the search count until the search completes and
// gives us a valid (possibly zero) searchCount.
if (this.props.searchInfo &&
this.props.searchInfo.searchCount !== undefined &&
this.props.searchInfo.searchCount !== null) {
searchStatus =
{ _t("(~%(count)s results)", { count: this.props.searchInfo.searchCount }) }
;
}
// XXX: this is a bit inefficient - we could just compare room.name for 'Empty room'...
let settingsHint = false;
const members = this.props.room ? this.props.room.getJoinedMembers() : undefined;
if (members) {
if (members.length === 1 && members[0].userId === MatrixClientPeg.get().credentials.userId) {
const nameEvent = this.props.room.currentState.getStateEvents('m.room.name', '');
if (!nameEvent || !nameEvent.getContent().name) {
settingsHint = true;
}
}
}
let roomName = _t("Join Room");
if (this.props.oobData && this.props.oobData.name) {
roomName = this.props.oobData.name;
} else if (this.props.room) {
roomName = this.props.room.name;
}
const emojiTextClasses = classNames('mx_RoomHeader_nametext', { mx_RoomHeader_settingsHint: settingsHint });
name =
{ roomName }
{ searchStatus }
;
}
if (canSetRoomTopic) {
const RoomTopicEditor = sdk.getComponent("rooms.RoomTopicEditor");
topicElement = ;
} else {
let topic;
if (this.props.room) {
const ev = this.props.room.currentState.getStateEvents('m.room.topic', '');
if (ev) {
topic = ev.getContent().topic;
}
}
if (topic) {
topicElement =
{ topic }
;
}
}
let roomAvatar = null;
if (canSetRoomAvatar) {
roomAvatar = (
);
} else if (this.props.room || (this.props.oobData && this.props.oobData.name)) {
roomAvatar = (
);
}
if (this.props.onSettingsClick) {
settingsButton =
;
}
// var leave_button;
// if (this.props.onLeaveClick) {
// leave_button =
//
//
//
;
// }
let forgetButton;
if (this.props.onForgetClick) {
forgetButton =
;
}
let searchButton;
if (this.props.onSearchClick && this.props.inRoom) {
searchButton =
;
}
let rightPanelButtons;
if (this.props.collapsedRhs) {
rightPanelButtons =
;
}
let rightRow;
let integrationsButton;
let integrationsError;
if (this.scalarClient !== null) {
if (this.state.showIntegrationsError && this.state.scalar_error) {
console.error(this.state.scalar_error);
integrationsError = (
{ _t('Could not connect to the integration server') }
);
}
if (this.scalarClient.hasCredentials()) {
integrationsButton = (
);
} else if (this.state.scalar_error) {
integrationsButton = (
{ integrationsError }
);
} else {
integrationsButton = (
);
}
}
if (!this.props.editing) {
rightRow =
{ settingsButton }
{ integrationsButton }
{ forgetButton }
{ searchButton }
{ rightPanelButtons }
;
}
return (
{ roomAvatar }
{ name }
{ topicElement }
{spinner}
{saveButton}
{cancelButton}
{rightRow}
);
},
});