Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

New guest access #937

Merged
merged 168 commits into from
Jun 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
8774100
Initial implementation: SetDisplayName -> SetMxIdDialog
Apr 28, 2017
6dff4a4
Return early after cancelled mxid dialog
Apr 28, 2017
d12b190
Fix defer promise logic
Apr 28, 2017
5a5768a
Try to fix tests
Apr 28, 2017
a887af9
copyright
May 2, 2017
4f71f4c
Store mx_pass at the same point as access_token
May 2, 2017
13d37e4
Mock isGuest
May 2, 2017
863430c
Merge pull request #849 from matrix-org/luke/new-guest-access-set-mxid
lukebarnard1 May 2, 2017
18ba5d3
fix typo
t3chguy May 3, 2017
aa639ca
Merge pull request #858 from t3chguy/patch-3
lukebarnard1 May 4, 2017
6f4eb9d
Show password nag bar when user is PWLU
May 5, 2017
69382d3
Merge pull request #864 from matrix-org/luke/show-pwd-nag-bar
lukebarnard1 May 8, 2017
ad2ed12
Redesign mxID chooser, add availability checking
May 10, 2017
6257bfc
Add prop type for onDifferentServerClicked
May 10, 2017
6ba1d38
Merge pull request #877 from matrix-org/luke/new-guest-access-set-mxid-2
lukebarnard1 May 10, 2017
5151264
Merge branch 'develop' into new-guest-access
May 11, 2017
6326a95
Prevent ROUs from creating new chats/new rooms
May 11, 2017
cfa108a
No need to dispatch, just call setMxId
May 11, 2017
8725ef3
Remove "Current Password" input if mx_pass exists
May 11, 2017
81806e2
Merge pull request #879 from matrix-org/luke/rou-set-mxid
lukebarnard1 May 11, 2017
1176573
Implement SessionStore
May 12, 2017
5c8187d
Explicitly pass thru userHasGeneratedPassword
May 12, 2017
6ffe7ef
Use same singleton impl as MatrixClientPeg for SessionStore
May 12, 2017
536724e
ES6 SessionStore
May 12, 2017
2b4c87a
Remove useless comment
May 12, 2017
683f1b8
Invite the welcome user after registration if configured
May 12, 2017
da3cb0e
SessionStore extends flux.Store
May 15, 2017
f73cf77
Move sessionStore ref from MatrixChat to LoggedInView
May 15, 2017
5584a5c
Merge pull request #882 from matrix-org/luke/new-guest-access-welcome…
lukebarnard1 May 15, 2017
eb0041d
Remove redundant state
May 15, 2017
269fd51
Remove SessionStore listener on unmount
May 15, 2017
f199f35
Replace NeedToRegisterDialog /w SetMxIdDialog
May 15, 2017
d7eec27
Merge pull request #889 from matrix-org/luke/new-guest-access-need-to…
lukebarnard1 May 15, 2017
93ecdc9
Make confirmation optional on ChangePassword
May 16, 2017
f7e6a99
Add proptype
May 16, 2017
eb36e97
Reference store token, call .remove on it on unmount
May 16, 2017
633c6b3
Add comment to Lifecycle
May 16, 2017
c635037
Merge pull request #881 from matrix-org/luke/user-settings-remove-cur…
lukebarnard1 May 16, 2017
5a3c320
disableConfirmation -> confirm
May 16, 2017
66985e6
Merge branch 'new-guest-access' into luke/new-guest-access-change-pwd
lukebarnard1 May 16, 2017
49437e3
Merge pull request #890 from matrix-org/luke/new-guest-access-change-pwd
lukebarnard1 May 16, 2017
2c5fb01
Fix bugs introduced by dodgy merge
May 16, 2017
ca907f4
Fix redundant getComponent
May 16, 2017
e108957
Write some tests for the RTS UI
May 17, 2017
818f21c
Merge pull request #893 from matrix-org/luke/unit-test-rts-reg
lukebarnard1 May 17, 2017
96c3bf5
Implement warm-fuzzy success dialog for SetMxIdDialog
May 19, 2017
c51f4b1
Merge pull request #905 from matrix-org/luke/new-guest-access-set-mxi…
lukebarnard1 May 19, 2017
a1f10ff
Add prop to toggle whether new password input is autoFocused
May 22, 2017
e4d3588
Merge pull request #915 from matrix-org/luke/new-guest-access-autoFoc…
dbkr May 22, 2017
05aaa59
Merge branch 'develop' into new-guest-access
May 22, 2017
b0a824c
Remove double declaration of TextInputDialog
May 22, 2017
867f891
Merge pull request #917 from matrix-org/dbkr/use_right_riot_branch
lukebarnard1 May 22, 2017
298c5e4
Implement a store for RoomView
May 24, 2017
c96d93b
Merge branch 'new-guest-access' into luke/new-guest-access-room-view-…
May 24, 2017
5f36f79
Implement default welcome page and allow custom URL /w config
May 24, 2017
dcf2fb6
Remove console log
May 24, 2017
fffe425
Add non-null RoomView key
May 24, 2017
8fc44a9
Add comment to explain sync_state dispatch
May 25, 2017
4541346
Merge pull request #921 from matrix-org/luke/new-guest-access-room-vi…
lukebarnard1 May 25, 2017
f3fc459
Merge pull request #922 from matrix-org/luke/new-guest-access-default…
lukebarnard1 May 25, 2017
c894c83
Remove GuestWarningBar
May 25, 2017
5531f27
Make the left panel more friendly to new users
dbkr Apr 26, 2017
d6d9a89
Other empty sections no longer need to be greyed
dbkr Apr 28, 2017
bff0577
Add buttons to room sub list headers
dbkr May 4, 2017
54af06e
What year is it? Who's the president?
dbkr May 4, 2017
a996f52
Make bottom left menu buttons use RoleButton too
dbkr May 4, 2017
3d3d892
Year
dbkr May 4, 2017
99efbbe
Depend on prop-types module
dbkr May 4, 2017
dc2274d
Hide empty tips if collapsed
dbkr May 4, 2017
9337158
Separate classes for the different buttons
dbkr May 5, 2017
5e855e6
Size is a string, import react
dbkr May 5, 2017
548f319
Remove redundant role elements
dbkr May 5, 2017
3185d3e
Re-add bouncing/callout animation to action buttons
May 25, 2017
7900bf1
Don't show "Drop to ..." if total rooms = 0
May 25, 2017
ce4e11a
Merge pull request #924 from matrix-org/luke/new-guest-access-left-panel
dbkr May 25, 2017
c54a24c
Merge pull request #923 from matrix-org/luke/remove-guest-warning-bar
dbkr May 25, 2017
51c8ee6
Allow teamServerConfig to be missing
May 25, 2017
2265b59
Remove warm-fuzzy after setting mxid
May 25, 2017
09c5b2f
Merge pull request #925 from matrix-org/luke/new-guest-access-fix-tea…
lukebarnard1 May 25, 2017
1214b01
Merge pull request #926 from matrix-org/luke/new-guest-access-set-mxi…
lukebarnard1 May 25, 2017
ce17df0
Unbreak the roomlist
May 25, 2017
0707b74
Merge branch 'new-guest-access' of github.com:matrix-org/matrix-react…
May 25, 2017
11799b4
Show "Password" instead of "New Password" when the existing password …
May 25, 2017
6218a86
Merge pull request #927 from matrix-org/luke/new-guest-access-not-new…
lukebarnard1 May 25, 2017
91edc06
Use RVS to indicate "joining" when setting a mxid
May 25, 2017
0849b0e
Fix view_next_room, view_previous_room and view_indexed_room
May 25, 2017
263a519
Reset store state when logging out
May 25, 2017
b5b157a
Don't show notif nag bar if guest
May 26, 2017
2dcc039
Set the displayname to the mxid once PWLU
May 26, 2017
c0f43a1
Improve comment
May 26, 2017
2400efa
Correct LifecycleStore docs
May 26, 2017
ad33737
Warn about LifecycleStore not explicitly being used
May 26, 2017
28094a9
Show "Something went wrong!" when errcode undefined
May 26, 2017
5e13686
Block user settings with view_set_mxid
May 26, 2017
9f902c1
Merge pull request #932 from matrix-org/luke/new-guest-access-no-noti…
lukebarnard1 May 26, 2017
fbc3f83
Merge pull request #928 from matrix-org/luke/new-guest-access-inidica…
ara4n May 26, 2017
1c77855
Merge pull request #929 from matrix-org/luke/new-guest-access-fix-vie…
ara4n May 26, 2017
3d688a6
Merge pull request #933 from matrix-org/luke/new-guest-access-set-dis…
ara4n May 26, 2017
9311b90
Use the same `.reset` as RoomViewStore
May 26, 2017
ac44151
Put the reset method in the right scope...
May 26, 2017
44f479c
Merge pull request #930 from matrix-org/luke/new-guest-access-reset-s…
ara4n May 26, 2017
ed79a3a
Merge pull request #935 from matrix-org/luke/new-guest-access-no-barf…
ara4n May 26, 2017
fd27d6d
Merge pull request #936 from matrix-org/luke/new-guest-access-need-to…
lukebarnard1 May 26, 2017
5c88592
Merge branch 'develop' into new-guest-access
ara4n May 28, 2017
1efc5c2
speed up SetMxIdDialog user check to 250ms as it was driving me MAD
ara4n May 28, 2017
df59989
add login link to SetMxIdDialog
ara4n May 29, 2017
ad1b149
hide rightpanel on welcome page
ara4n May 30, 2017
9536e1e
Merge pull request #954 from matrix-org/matthew/ilag-login
lukebarnard1 May 30, 2017
952651c
Allow pressing Enter to submit setMxId
May 30, 2017
47bf540
Use KeyCode.ENTER instead of 13
May 30, 2017
e281373
Merge pull request #961 from matrix-org/luke/enter-to-submit-mxid
ara4n May 30, 2017
2baef64
Add /start to show the setMxId above HomePage
May 30, 2017
90c2fc0
Merge pull request #964 from matrix-org/luke/start-url
ara4n May 30, 2017
6f8d5b1
Remove spurious reference to `otherTagNames`
May 30, 2017
b51f5ac
Merge branch 'new-guest-access' of github.com:matrix-org/matrix-react…
May 30, 2017
40154df
Show People/Rooms emptySubListTip even when total rooms !== 0
May 30, 2017
e30e45a
Merge branch 'develop' into new-guest-access
ara4n May 30, 2017
c15568e
remove spurious string
ara4n May 30, 2017
d83f18a
Remove cachedPassword from localStorage on_logged_out
May 31, 2017
d0e270b
Only re-render LoggedInView if MatrixClientPeg.get() is truthy
May 31, 2017
b3a862c
Remove redundant `reset`
May 31, 2017
7abaadd
Merge pull request #977 from matrix-org/luke/session-store-null-on-lo…
lukebarnard1 May 31, 2017
8192374
Add missing _t import
May 31, 2017
dd48b3f
Add comment
Jun 1, 2017
16c4c14
Fix to show the correct room
Jun 1, 2017
7808994
Modify RVS test to wait until room loaded
Jun 2, 2017
d81160d
Merge pull request #995 from matrix-org/luke/new-guest-access-fix-wro…
dbkr Jun 2, 2017
be7c261
Merge pull request #967 from matrix-org/luke/show-people-rooms-tooltips
lukebarnard1 Jun 2, 2017
defecb1
Implement /user/@userid:domain?action=chat
Jun 1, 2017
6a9781f
Remove redundant state
Jun 2, 2017
e88b52f
Add comment
Jun 2, 2017
6e84b6e
Display profile errors better
Jun 2, 2017
03f4f26
Propagate room join errors to the UI
dbkr Jun 2, 2017
95e38eb
Remove cryptic log
Jun 2, 2017
953a573
Merge pull request #1006 from matrix-org/luke/new-guest-access-user-a…
lukebarnard1 Jun 2, 2017
f52035f
Set state from dispatch payload unconditionally
dbkr Jun 2, 2017
ac0f2f7
Remove redundant room_id
dbkr Jun 2, 2017
ec0ad93
Merge pull request #1007 from matrix-org/dbkr/propagate_room_join_errors
dbkr Jun 2, 2017
2cc9f9c
Fix accepting a 3pid invite
dbkr Jun 2, 2017
792f825
Merge pull request #1013 from matrix-org/dbkr/fix_3pid_invite_pwlu
dbkr Jun 2, 2017
239874c
Introduce state `peekLoading` to avoid collision with `roomLoading`
Jun 5, 2017
d72db5d
Merge pull request #1028 from matrix-org/luke/fix-room-change-peek-sp…
lukebarnard1 Jun 5, 2017
beafb68
Don't do a deferred start chat if user is welcome user
Jun 5, 2017
3195b9f
Keep deferred actions for view_user_settings and view_create_chat
Jun 5, 2017
cdd8cc4
Merge pull request #1029 from matrix-org/luke/fix-multi-welcome-user
dbkr Jun 5, 2017
c82e79a
Only view welcome user if we are not looking at a room
Jun 5, 2017
d8e3423
Merge pull request #1031 from matrix-org/luke/fix-deferred-start-chat…
dbkr Jun 5, 2017
85aa3f6
Merge pull request #1032 from matrix-org/luke/fix-welcome-user-backgr…
dbkr Jun 5, 2017
6125395
_t for SetMxIdDialog
Jun 5, 2017
6198306
Merge branch 'develop' into luke/ilag-i18n
Jun 5, 2017
9f6ab4a
Add en_EN i18n strings for setMxIdDialog
Jun 5, 2017
ad87e9b
Apply https://github.com/matrix-org/matrix-react-sdk/commit/9cae667c0…
dbkr Jun 5, 2017
2030c18
Merge pull request #1037 from matrix-org/dbkr/fix_create_room_button_…
lukebarnard1 Jun 5, 2017
c690acc
Add missing command
Jun 5, 2017
5924654
Defer an intention for creating a room
dbkr Jun 5, 2017
3553aea
Merge pull request #1038 from matrix-org/dbkr/ilag_defer_create_room
dbkr Jun 5, 2017
f6cfff9
Cancel deferred actions
dbkr Jun 5, 2017
4ab6dc9
Merge branch 'new-guest-access' into luke/ilag-i18n
lukebarnard1 Jun 5, 2017
ad74075
Merge pull request #1034 from matrix-org/luke/ilag-i18n
lukebarnard1 Jun 5, 2017
a99f652
Merge pull request #1039 from matrix-org/dbkr/ilag_cancel_action
dbkr Jun 5, 2017
f8198ba
Merge branch 'develop' into new-guest-access
dbkr Jun 6, 2017
22df039
Merge branch 'develop' into new-guest-access
dbkr Jun 6, 2017
12d2480
Reset 'first sync' flag / promise on log in
dbkr Jun 6, 2017
c27f502
comment
dbkr Jun 6, 2017
9c30de0
Merge pull request #1041 from matrix-org/dbkr/reset_first_sync_promise
dbkr Jun 6, 2017
1dbdbc1
Cancel 'join room' action if 'log in' is clicked
dbkr Jun 7, 2017
ccaa55d
Merge pull request #1049 from matrix-org/dbkr/ilag_cancel_join_on_login
dbkr Jun 7, 2017
53ea41e
Merge branch 'develop' into new-guest-access
lukebarnard1 Jun 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ npm-debug.log

/.idea
/src/component-index.js

.DS_Store
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"lodash": "^4.13.1",
"matrix-js-sdk": "0.7.10",
"optimist": "^0.6.1",
"prop-types": "^15.5.8",
"q": "^1.4.1",
"react": "^15.4.0",
"react-addons-css-transition-group": "15.3.2",
Expand Down
18 changes: 18 additions & 0 deletions src/Lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ function _registerAsGuest(hsUrl, isUrl, defaultDeviceDisplayName) {

// returns a promise which resolves to true if a session is found in
// localstorage
//
// N.B. Lifecycle.js should not maintain any further localStorage state, we
// are moving towards using SessionStore to keep track of state related
// to the current session (which is typically backed by localStorage).
//
// The plan is to gradually move the localStorage access done here into
// SessionStore to avoid bugs where the view becomes out-of-sync with
// localStorage (e.g. teamToken, isGuest etc.)
function _restoreFromLocalStorage() {
if (!localStorage) {
return q(false);
Expand Down Expand Up @@ -314,6 +322,16 @@ export function setLoggedIn(credentials) {
localStorage.setItem("mx_device_id", credentials.deviceId);
}

// The user registered as a PWLU (PassWord-Less User), the generated password
// is cached here such that the user can change it at a later time.
if (credentials.password) {
// Update SessionStore
dis.dispatch({
action: 'cached_password',
cachedPassword: credentials.password,
});
}

console.log("Session persisted for %s", credentials.userId);
} catch (e) {
console.warn("Error using local storage: can't persist session!", e);
Expand Down
64 changes: 49 additions & 15 deletions src/components/structures/LoggedInView.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import PageTypes from '../../PageTypes';
import CallMediaHandler from '../../CallMediaHandler';
import sdk from '../../index';
import dis from '../../dispatcher';
import sessionStore from '../../stores/SessionStore';
import MatrixClientPeg from '../../MatrixClientPeg';

/**
* This is what our MatrixChat shows when we are logged in. The precise view is
Expand All @@ -41,10 +43,13 @@ export default React.createClass({
propTypes: {
matrixClient: React.PropTypes.instanceOf(Matrix.MatrixClient).isRequired,
page_type: React.PropTypes.string.isRequired,
onRoomIdResolved: React.PropTypes.func,
onRoomCreated: React.PropTypes.func,
onUserSettingsClose: React.PropTypes.func,

// Called with the credentials of a registered user (if they were a ROU that
// transitioned to PWLU)
onRegistered: React.PropTypes.func,

teamToken: React.PropTypes.string,

// and lots and lots of other stuff.
Expand Down Expand Up @@ -83,12 +88,32 @@ export default React.createClass({
CallMediaHandler.loadDevices();

document.addEventListener('keydown', this._onKeyDown);

this._sessionStore = sessionStore;
this._sessionStoreToken = this._sessionStore.addListener(
this._setStateFromSessionStore,
);
this._setStateFromSessionStore();

this._matrixClient.on("accountData", this.onAccountData);
},

componentWillUnmount: function() {
document.removeEventListener('keydown', this._onKeyDown);
this._matrixClient.removeListener("accountData", this.onAccountData);
if (this._sessionStoreToken) {
this._sessionStoreToken.remove();
}
},

// Child components assume that the client peg will not be null, so give them some
// sort of assurance here by only allowing a re-render if the client is truthy.
//
// This is required because `LoggedInView` maintains its own state and if this state
// updates after the client peg has been made null (during logout), then it will
// attempt to re-render and the children will throw errors.
shouldComponentUpdate: function() {
return Boolean(MatrixClientPeg.get());
},

getScrollStateForRoom: function(roomId) {
Expand All @@ -102,10 +127,16 @@ export default React.createClass({
return this.refs.roomView.canResetTimeline();
},

_setStateFromSessionStore() {
this.setState({
userHasGeneratedPassword: Boolean(this._sessionStore.getCachedPassword()),
});
},

onAccountData: function(event) {
if (event.getType() === "im.vector.web.settings") {
this.setState({
useCompactLayout: event.getContent().useCompactLayout
useCompactLayout: event.getContent().useCompactLayout,
});
}
},
Expand Down Expand Up @@ -180,8 +211,8 @@ export default React.createClass({
const RoomDirectory = sdk.getComponent('structures.RoomDirectory');
const HomePage = sdk.getComponent('structures.HomePage');
const MatrixToolbar = sdk.getComponent('globals.MatrixToolbar');
const GuestWarningBar = sdk.getComponent('globals.GuestWarningBar');
const NewVersionBar = sdk.getComponent('globals.NewVersionBar');
const PasswordNagBar = sdk.getComponent('globals.PasswordNagBar');

let page_element;
let right_panel = '';
Expand All @@ -190,15 +221,14 @@ export default React.createClass({
case PageTypes.RoomView:
page_element = <RoomView
ref='roomView'
roomAddress={this.props.currentRoomAlias || this.props.currentRoomId}
autoJoin={this.props.autoJoin}
onRoomIdResolved={this.props.onRoomIdResolved}
onRegistered={this.props.onRegistered}
eventId={this.props.initialEventId}
thirdPartyInvite={this.props.thirdPartyInvite}
oobData={this.props.roomOobData}
highlightedEventId={this.props.highlightedEventId}
eventPixelOffset={this.props.initialEventPixelOffset}
key={this.props.currentRoomAlias || this.props.currentRoomId}
key={this.props.currentRoomId || 'roomview'}
opacity={this.props.middleOpacity}
collapsedRhs={this.props.collapse_rhs}
ConferenceHandler={this.props.ConferenceHandler}
Expand Down Expand Up @@ -235,12 +265,18 @@ export default React.createClass({
break;

case PageTypes.HomePage:
// If team server config is present, pass the teamServerURL. props.teamToken
// must also be set for the team page to be displayed, otherwise the
// welcomePageUrl is used (which might be undefined).
const teamServerUrl = this.props.config.teamServerConfig ?
this.props.config.teamServerConfig.teamServerURL : null;

page_element = <HomePage
collapsedRhs={this.props.collapse_rhs}
teamServerUrl={this.props.config.teamServerConfig.teamServerURL}
teamServerUrl={teamServerUrl}
teamToken={this.props.teamToken}
/>
if (!this.props.collapse_rhs) right_panel = <RightPanel opacity={this.props.rightOpacity}/>
homePageUrl={this.props.config.welcomePageUrl}
/>;
break;

case PageTypes.UserView:
Expand All @@ -249,16 +285,15 @@ export default React.createClass({
break;
}

const isGuest = this.props.matrixClient.isGuest();
var topBar;
if (this.props.hasNewVersion) {
topBar = <NewVersionBar version={this.props.version} newVersion={this.props.newVersion}
releaseNotes={this.props.newVersionReleaseNotes}
/>;
}
else if (this.props.matrixClient.isGuest()) {
topBar = <GuestWarningBar />;
}
else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
} else if (this.state.userHasGeneratedPassword) {
topBar = <PasswordNagBar />;
} else if (!isGuest && Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) {
topBar = <MatrixToolbar />;
}

Expand All @@ -278,7 +313,6 @@ export default React.createClass({
selectedRoom={this.props.currentRoomId}
collapsed={this.props.collapse_lhs || false}
opacity={this.props.leftOpacity}
teamToken={this.props.teamToken}
/>
<main className='mx_MatrixChat_middlePanel'>
{page_element}
Expand Down
Loading