From 1f719b3f7d379470e451513d1e8ad0fdcd896c5f Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 16 Jun 2017 13:06:28 +0100 Subject: [PATCH 1/3] Avoid getting stuck in a loop in CAS login 498ea53 made it so that the #/login URL fragment was prioritised over the token params in the query string; unfortunately that also means that CAS login gets stuck in a loop where you always get redirected back to the login view. Prioritising the URL fragment over the token params may or may not be the correct thing to, but I also think it's incorrect that we ask the CAS server to redirect us back to #/login. Accordingly, the easiest fix here is just to clear the URL fragment before redirecting to CAS. --- src/Login.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Login.js b/src/Login.js index 8db6e99b89..8225509919 100644 --- a/src/Login.js +++ b/src/Login.js @@ -178,11 +178,18 @@ export default class Login { } redirectToCas() { - var client = this._createTemporaryClient(); - var parsedUrl = url.parse(window.location.href, true); + const client = this._createTemporaryClient(); + const parsedUrl = url.parse(window.location.href, true); + + // XXX: at this point, the fragment will always be #/login, which is no + // use to anyone. Ideally, we would get the intended fragment from + // MatrixChat.screenAfterLogin so that you could follow #/room links etc + // through a CAS login. + parsedUrl.hash = ""; + parsedUrl.query["homeserver"] = client.getHomeserverUrl(); parsedUrl.query["identityServer"] = client.getIdentityServerUrl(); - var casUrl = client.getCasLoginUrl(url.format(parsedUrl)); + const casUrl = client.getCasLoginUrl(url.format(parsedUrl)); window.location.href = casUrl; } } From aa7ddfe86ebc076f0dc8c6b324a94f2271bc5427 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 16 Jun 2017 15:47:40 +0100 Subject: [PATCH 2/3] Remove unused collapse_rhs Remove all the places we pass collapse_rhs through to places it's never used. Remove the commented RHS collapse button from SimpleRoomHeader. --- src/components/structures/LoggedInView.js | 2 -- src/components/structures/UserSettings.js | 4 ---- .../views/rooms/SimpleRoomHeader.js | 23 ------------------- 3 files changed, 29 deletions(-) diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 8fa35e84d7..8b0bcaad68 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -239,7 +239,6 @@ export default React.createClass({ page_element = diff --git a/src/components/views/rooms/SimpleRoomHeader.js b/src/components/views/rooms/SimpleRoomHeader.js index 44ec7c29aa..8c06d71b6f 100644 --- a/src/components/views/rooms/SimpleRoomHeader.js +++ b/src/components/views/rooms/SimpleRoomHeader.js @@ -14,10 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -'use strict'; - import React from 'react'; -import dis from '../../../dispatcher'; import AccessibleButton from '../elements/AccessibleButton'; import sdk from '../../../index'; import { _t } from '../../../languageHandler'; @@ -45,17 +42,10 @@ export default React.createClass({ title: React.PropTypes.string, onCancelClick: React.PropTypes.func, - // is the RightPanel collapsed? - collapsedRhs: React.PropTypes.bool, - // `src` to a TintableSvg. Optional. icon: React.PropTypes.string, }, - onShowRhsClick: function(ev) { - dis.dispatch({ action: 'show_right_panel' }); - }, - render: function() { let cancelButton; let icon; @@ -70,25 +60,12 @@ export default React.createClass({ />; } - let showRhsButton; - /* // don't bother cluttering things up with this for now. - const TintableSvg = sdk.getComponent("elements.TintableSvg"); - - if (this.props.collapsedRhs) { - showRhsButton = -
- -
- } - */ - return (
{ icon } { this.props.title } - { showRhsButton } { cancelButton }
From be58e1095e7ce5da5a994f3ae471761cf6c10a38 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 16 Jun 2017 18:24:07 +0100 Subject: [PATCH 3/3] Don't peek when creating a room This causes a race between receiving the room when starting to peek and receiving the room from joining it - https://github.com/vector-im/riot-web/issues/4330, https://github.com/matrix-org/riot-web-rageshakes/issues/196 --- src/components/structures/RoomView.js | 15 ++++++++++----- src/createRoom.js | 1 + src/stores/RoomViewStore.js | 6 ++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 9306008e71..25500d7739 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -93,6 +93,7 @@ module.exports = React.createClass({ roomId: null, roomLoading: true, peekLoading: false, + shouldPeek: true, // The event to be scrolled to initially initialEventId: null, @@ -168,8 +169,13 @@ module.exports = React.createClass({ initialEventId: RoomViewStore.getInitialEventId(), initialEventPixelOffset: RoomViewStore.getInitialEventPixelOffset(), isInitialEventHighlighted: RoomViewStore.isInitialEventHighlighted(), + shouldPeek: RoomViewStore.shouldPeek(), }; + // finished joining, start waiting for a room and show a spinner. See onRoom. + newState.waitingForRoom = this.state.joining && !newState.joining && + !RoomViewStore.getJoinError(); + // Temporary logging to diagnose https://github.com/vector-im/riot-web/issues/4307 console.log( 'RVS update:', @@ -177,12 +183,11 @@ module.exports = React.createClass({ newState.roomAlias, 'loading?', newState.roomLoading, 'joining?', newState.joining, + 'initial?', initial, + 'waiting?', newState.waitingForRoom, + 'shouldPeek?', newState.shouldPeek, ); - // finished joining, start waiting for a room and show a spinner. See onRoom. - newState.waitingForRoom = this.state.joining && !newState.joining && - !RoomViewStore.getJoinError(); - // NB: This does assume that the roomID will not change for the lifetime of // the RoomView instance if (initial) { @@ -238,7 +243,7 @@ module.exports = React.createClass({ if (!this.state.joining && this.state.roomId) { if (this.props.autoJoin) { this.onJoinButtonClicked(); - } else if (!room) { + } else if (!room && this.state.shouldPeek) { console.log("Attempting to peek into room %s", this.state.roomId); this.setState({ peekLoading: true, diff --git a/src/createRoom.js b/src/createRoom.js index 4d7f5792f3..bf0c0fee1c 100644 --- a/src/createRoom.js +++ b/src/createRoom.js @@ -100,6 +100,7 @@ function createRoom(opts) { dis.dispatch({ action: 'view_room', room_id: roomId, + should_peek: false, }); } return roomId; diff --git a/src/stores/RoomViewStore.js b/src/stores/RoomViewStore.js index ac06d41e81..38f16f945b 100644 --- a/src/stores/RoomViewStore.js +++ b/src/stores/RoomViewStore.js @@ -129,6 +129,8 @@ class RoomViewStore extends Store { isInitialEventHighlighted: payload.highlighted, roomLoading: false, roomLoadError: null, + // should peek by default + shouldPeek: payload.should_peek === undefined ? true : payload.should_peek, }; // If an event ID wasn't specified, default to the one saved for this room @@ -276,6 +278,10 @@ class RoomViewStore extends Store { getJoinError() { return this._state.joinError; } + + shouldPeek() { + return this._state.shouldPeek; + } } let singletonRoomViewStore = null;