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

Commit 34e40c3

Browse files
author
Weblate
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents cb14b28 + 3b23fc7 commit 34e40c3

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/components/structures/RoomView.js

Lines changed: 4 additions & 4 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

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)