Merge pull request #3670 from matrix-org/travis/toggle-communities

Make the communities button behave more like a toggle
This commit is contained in:
Travis Ralston 2019-11-27 07:52:05 -07:00 committed by GitHub
commit fbba55ab05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -627,6 +627,22 @@ export default createReactClass({
case 'view_invite': case 'view_invite':
showRoomInviteDialog(payload.roomId); showRoomInviteDialog(payload.roomId);
break; break;
case 'view_last_screen':
// This function does what we want, despite the name. The idea is that it shows
// the last room we were looking at or some reasonable default/guess. We don't
// have to worry about email invites or similar being re-triggered because the
// function will have cleared that state and not execute that path.
this._showScreenAfterLogin();
break;
case 'toggle_my_groups':
// We just dispatch the page change rather than have to worry about
// what the logic is for each of these branches.
if (this.state.page_type === PageTypes.MyGroups) {
dis.dispatch({action: 'view_last_screen'});
} else {
dis.dispatch({action: 'view_my_groups'});
}
break;
case 'notifier_enabled': { case 'notifier_enabled': {
this.setState({showNotifierToolbar: Notifier.shouldShowToolbar()}); this.setState({showNotifierToolbar: Notifier.shouldShowToolbar()});
} }

View file

@ -22,7 +22,7 @@ import { _t } from '../../../languageHandler';
const GroupsButton = function(props) { const GroupsButton = function(props) {
const ActionButton = sdk.getComponent('elements.ActionButton'); const ActionButton = sdk.getComponent('elements.ActionButton');
return ( return (
<ActionButton className="mx_GroupsButton" action="view_my_groups" <ActionButton className="mx_GroupsButton" action="toggle_my_groups"
label={_t("Communities")} label={_t("Communities")}
size={props.size} size={props.size}
tooltip={true} tooltip={true}