message: Add room directory publish button
  This was previously missed in the tab's layout.
diff: @@ -23,6 +23,7 @@ import sdk from "../../../../index";
  import AccessibleButton from "../../elements/AccessibleButton";
  import {MatrixClient} from "matrix-js-sdk";
  import dis from "../../../../dispatcher";
  +import LabelledToggleSwitch from "../../elements/LabelledToggleSwitch";
  export default class GeneralRoomSettingsTab extends React.Component {
  static childContextTypes = {
  @@ -33,12 +34,40 @@ export default class GeneralRoomSettingsTab extends React.Component {
  roomId: PropTypes.string.isRequired,
  };
  + constructor() {
  + super();
  +
  + this.state = {
  + isRoomPublished: false, // loaded async
  + };
  + }
  +
  getChildContext() {
  return {
  matrixClient: MatrixClientPeg.get(),
  };
  }
  + componentWillMount() {
  + MatrixClientPeg.get().getRoomDirectoryVisibility(this.props.roomId).then((result => {
  + this.setState({isRoomPublished: result.visibility === 'public'});
  + }));
  + }
  +
  + onRoomPublishChange = (e) => {
  + const valueBefore = this.state.isRoomPublished;
  + const newValue = !valueBefore;
  + this.setState({isRoomPublished: newValue});
  +
  + MatrixClientPeg.get().setRoomDirectoryVisibility(
  + this.props.roomId,
  + newValue ? 'public' : 'private',
  + ).catch(() => {
  + // Roll back the local echo on the change
  + this.setState({isRoomPublished: valueBefore});
  + });
  + };
  +
  _saveAliases = (e) => {
  // TODO: Live modification?
  if (!this.refs.aliasSettings) return;
  @@ -67,6 +96,7 @@ export default class GeneralRoomSettingsTab extends React.Component {
  const room = client.getRoom(this.props.roomId);
  const canSetAliases = true; // Previously, we arbitrarily only allowed admins to do this
  + const canActuallySetAliases = room.currentState.mayClientSendStateEvent("m.room.aliases", client);
  const canSetCanonical = room.currentState.mayClientSendStateEvent("m.room.canonical_alias", client);
  const canonicalAliasEv = room.currentState.getStateEvents("m.room.canonical_alias", '');
  const aliasEvents = room.currentState.getStateEvents("m.room.aliases");
  @@ -90,6 +120,14 @@ export default class GeneralRoomSettingsTab extends React.Component {
  {_t("Save")}
  </AccessibleButton>
  </div>
  + <div className='mx_SettingsTab_section'>
  + <LabelledToggleSwitch value={this.state.isRoomPublished}
  + onChange={this.onRoomPublishChange}
  + disabled={!canActuallySetAliases}
  + label={_t("Publish this room to the public in %(domain)s's room directory?", {
  + domain: client.getDomain(),
  + })} />
  + </div>
  <span className='mx_SettingsTab_subheading'>{_t("Flair")}</span>
  <div className='mx_SettingsTab_section mx_SettingsTab_subsectionText'>
  