From a8594a58e5f546f1cc10e89268d174b7a23b6faf Mon Sep 17 00:00:00 2001
From: Luke Barnard <luke@matrix.org>
Date: Tue, 28 Nov 2017 12:08:53 +0000
Subject: [PATCH] Allow guest to see MyGroups, show ILAG when creating a group

---
 src/components/structures/MatrixChat.js |  8 ++++++--
 src/components/structures/MyGroups.js   | 10 +++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 23bdee4a03..cd75ad8798 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -81,8 +81,7 @@ const ONBOARDING_FLOW_STARTERS = [
     'view_user_settings',
     'view_create_chat',
     'view_create_room',
-    'view_my_groups',
-    'view_group',
+    'view_create_group',
 ];
 
 module.exports = React.createClass({
@@ -501,6 +500,11 @@ module.exports = React.createClass({
             case 'view_create_room':
                 this._createRoom();
                 break;
+            case 'view_create_group': {
+                const CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog");
+                Modal.createTrackedDialog('Create Community', '', CreateGroupDialog);
+            }
+            break;
             case 'view_room_directory':
                 this._setPage(PageTypes.RoomDirectory);
                 this.notifyNewScreen('directory');
diff --git a/src/components/structures/MyGroups.js b/src/components/structures/MyGroups.js
index 2e8bae52c3..9281fb199e 100644
--- a/src/components/structures/MyGroups.js
+++ b/src/components/structures/MyGroups.js
@@ -18,9 +18,9 @@ import React from 'react';
 import GeminiScrollbar from 'react-gemini-scrollbar';
 import sdk from '../../index';
 import { _t } from '../../languageHandler';
+import dis from '../../dispatcher';
 import withMatrixClient from '../../wrappers/withMatrixClient';
 import AccessibleButton from '../views/elements/AccessibleButton';
-import Modal from '../../Modal';
 
 export default withMatrixClient(React.createClass({
     displayName: 'MyGroups',
@@ -41,14 +41,18 @@ export default withMatrixClient(React.createClass({
     },
 
     _onCreateGroupClick: function() {
-        const CreateGroupDialog = sdk.getComponent("dialogs.CreateGroupDialog");
-        Modal.createTrackedDialog('Create Community', '', CreateGroupDialog);
+        dis.dispatch({action: 'view_create_group'});
     },
 
     _fetch: function() {
         this.props.matrixClient.getJoinedGroups().done((result) => {
             this.setState({groups: result.groups, error: null});
         }, (err) => {
+            if (err.errcode === 'M_GUEST_ACCESS_FORBIDDEN') {
+                // Indicate that the guest isn't in any groups (which should be true)
+                this.setState({groups: [], error: null});
+                return;
+            }
             this.setState({groups: null, error: err});
         });
     },