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

Commit f2bcf4d

Browse files
committed
Merge remote-tracking branch 'origin/develop' into release-v0.9.5
2 parents 8243675 + 6a2c2d6 commit f2bcf4d

File tree

11 files changed

+1147
-82
lines changed

11 files changed

+1147
-82
lines changed

src/Login.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,18 @@ export default class Login {
178178
}
179179

180180
redirectToCas() {
181-
var client = this._createTemporaryClient();
182-
var parsedUrl = url.parse(window.location.href, true);
181+
const client = this._createTemporaryClient();
182+
const parsedUrl = url.parse(window.location.href, true);
183+
184+
// XXX: at this point, the fragment will always be #/login, which is no
185+
// use to anyone. Ideally, we would get the intended fragment from
186+
// MatrixChat.screenAfterLogin so that you could follow #/room links etc
187+
// through a CAS login.
188+
parsedUrl.hash = "";
189+
183190
parsedUrl.query["homeserver"] = client.getHomeserverUrl();
184191
parsedUrl.query["identityServer"] = client.getIdentityServerUrl();
185-
var casUrl = client.getCasLoginUrl(url.format(parsedUrl));
192+
const casUrl = client.getCasLoginUrl(url.format(parsedUrl));
186193
window.location.href = casUrl;
187194
}
188195
}

src/components/structures/MatrixChat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ module.exports = React.createClass({
383383

384384
MatrixClientPeg.get().leave(payload.room_id).done(() => {
385385
modal.close();
386-
if (this.currentRoomId === payload.room_id) {
386+
if (this.state.currentRoomId === payload.room_id) {
387387
dis.dispatch({action: 'view_next_room'});
388388
}
389389
}, (err) => {

src/components/structures/RoomView.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ module.exports = React.createClass({
230230
if (room) {
231231
this._updateAutoComplete(room);
232232
this.tabComplete.loadEntries(room);
233+
this.setState({
234+
unsentMessageError: this._getUnsentMessageError(room),
235+
});
236+
this._onRoomLoaded(room);
233237
}
234238
if (!this.state.joining && this.state.roomId) {
235239
if (this.props.autoJoin) {
@@ -262,10 +266,6 @@ module.exports = React.createClass({
262266
} else if (room) {
263267
// Stop peeking because we have joined this room previously
264268
MatrixClientPeg.get().stopPeeking();
265-
this.setState({
266-
unsentMessageError: this._getUnsentMessageError(room),
267-
});
268-
this._onRoomLoaded(room);
269269
}
270270
},
271271

@@ -1463,7 +1463,7 @@ module.exports = React.createClass({
14631463

14641464
// We have no room object for this room, only the ID.
14651465
// We've got to this room by following a link, possibly a third party invite.
1466-
var room_alias = this.state.room_alias;
1466+
const roomAlias = this.state.roomAlias;
14671467
return (
14681468
<div className="mx_RoomView">
14691469
<RoomHeader ref="header"
@@ -1476,7 +1476,7 @@ module.exports = React.createClass({
14761476
onForgetClick={ this.onForgetClick }
14771477
onRejectClick={ this.onRejectThreepidInviteButtonClicked }
14781478
canPreview={ false } error={ this.state.roomLoadError }
1479-
roomAlias={room_alias}
1479+
roomAlias={roomAlias}
14801480
spinner={previewBarSpinner}
14811481
inviterName={inviterName}
14821482
invitedEmail={invitedEmail}

src/components/views/login/CaptchaForm.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ module.exports = React.createClass({
4646
};
4747
},
4848

49+
componentWillMount: function() {
50+
this._captchaWidgetId = null;
51+
},
52+
4953
componentDidMount: function() {
5054
// Just putting a script tag into the returned jsx doesn't work, annoyingly,
5155
// so we do this instead.
@@ -75,6 +79,10 @@ module.exports = React.createClass({
7579
}
7680
},
7781

82+
componentWillUnmount: function() {
83+
this._resetRecaptcha();
84+
},
85+
7886
_renderRecaptcha: function(divId) {
7987
if (!global.grecaptcha) {
8088
console.error("grecaptcha not loaded!");
@@ -90,12 +98,18 @@ module.exports = React.createClass({
9098
}
9199

92100
console.log("Rendering to %s", divId);
93-
global.grecaptcha.render(divId, {
101+
this._captchaWidgetId = global.grecaptcha.render(divId, {
94102
sitekey: publicKey,
95103
callback: this.props.onCaptchaResponse,
96104
});
97105
},
98106

107+
_resetRecaptcha: function() {
108+
if (this._captchaWidgetId !== null) {
109+
global.grecaptcha.reset(this._captchaWidgetId);
110+
}
111+
},
112+
99113
_onCaptchaLoaded: function() {
100114
console.log("Loaded recaptcha script.");
101115
try {

0 commit comments

Comments
 (0)