s/that/self/g

This commit is contained in:
Matthew Hodgson 2015-07-17 21:59:48 +01:00
parent 0d34728190
commit 10cdf46c2c
10 changed files with 83 additions and 38 deletions

View file

@ -0,0 +1,15 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

View file

@ -0,0 +1,15 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

View file

@ -0,0 +1,15 @@
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

View file

@ -30,9 +30,9 @@ module.exports = React.createClass({
mixins: [MemberListController], mixins: [MemberListController],
makeMemberTiles: function() { makeMemberTiles: function() {
var that = this; var self = this;
return Object.keys(that.state.memberDict).map(function(userId) { return Object.keys(self.state.memberDict).map(function(userId) {
var m = that.state.memberDict[userId]; var m = self.state.memberDict[userId];
return ( return (
<MemberTile key={userId} member={m} /> <MemberTile key={userId} member={m} />
); );

View file

@ -43,9 +43,9 @@ module.exports = {
enable: function() { enable: function() {
if (!this.havePermission()) { if (!this.havePermission()) {
var that = this; var self = this;
global.Notification.requestPermission(function() { global.Notification.requestPermission(function() {
that.forceUpdate(); self.forceUpdate();
}); });
} }

View file

@ -41,11 +41,11 @@ module.exports = {
}, },
componentDidMount: function() { componentDidMount: function() {
var that = this; var self = this;
setTimeout(function() { setTimeout(function() {
if (!that.isMounted()) return; if (!self.isMounted()) return;
that.setState({ self.setState({
memberDict: that.roomMembers() memberDict: self.roomMembers()
}); });
}, 50); }, 50);
}, },

View file

@ -100,16 +100,16 @@ module.exports = {
}, },
makeRoomTiles: function() { makeRoomTiles: function() {
var that = this; var self = this;
return this.state.roomList.map(function(room) { return this.state.roomList.map(function(room) {
var selected = room.roomId == that.props.selectedRoom; var selected = room.roomId == self.props.selectedRoom;
return ( return (
<RoomTile <RoomTile
room={room} room={room}
key={room.roomId} key={room.roomId}
selected={selected} selected={selected}
unread={that.state.activityMap[room.roomId] === 1} unread={self.state.activityMap[room.roomId] === 1}
highlight={that.state.activityMap[room.roomId] === 2} highlight={self.state.activityMap[room.roomId] === 2}
/> />
); );
}); });

View file

@ -163,12 +163,12 @@ module.exports = {
this.waiting_for_paginate = true; this.waiting_for_paginate = true;
var cap = this.state.messageCap + PAGINATE_SIZE; var cap = this.state.messageCap + PAGINATE_SIZE;
this.setState({messageCap: cap, paginating: true}); this.setState({messageCap: cap, paginating: true});
var that = this; var self = this;
MatrixClientPeg.get().scrollback(this.state.room, PAGINATE_SIZE).finally(function() { MatrixClientPeg.get().scrollback(this.state.room, PAGINATE_SIZE).finally(function() {
that.waiting_for_paginate = false; self.waiting_for_paginate = false;
if (that.isMounted()) { if (self.isMounted()) {
that.setState({ self.setState({
room: MatrixClientPeg.get().getRoom(that.props.roomId) room: MatrixClientPeg.get().getRoom(self.props.roomId)
}); });
} }
// wait and set paginating to false when the component updates // wait and set paginating to false when the component updates
@ -181,14 +181,14 @@ module.exports = {
}, },
onJoinButtonClicked: function(ev) { onJoinButtonClicked: function(ev) {
var that = this; var self = this;
MatrixClientPeg.get().joinRoom(this.props.roomId).then(function() { MatrixClientPeg.get().joinRoom(this.props.roomId).then(function() {
that.setState({ self.setState({
joining: false, joining: false,
room: MatrixClientPeg.get().getRoom(that.props.roomId) room: MatrixClientPeg.get().getRoom(self.props.roomId)
}); });
}, function(error) { }, function(error) {
that.setState({ self.setState({
joining: false, joining: false,
joinError: error joinError: error
}); });

View file

@ -169,7 +169,7 @@ module.exports = {
startMatrixClient: function() { startMatrixClient: function() {
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
var that = this; var self = this;
cli.on('syncComplete', function() { cli.on('syncComplete', function() {
var firstRoom = null; var firstRoom = null;
if (cli.getRooms() && cli.getRooms().length) { if (cli.getRooms() && cli.getRooms().length) {
@ -177,7 +177,7 @@ module.exports = {
cli.getRooms() cli.getRooms()
)[0].roomId; )[0].roomId;
} }
that.setState({ready: true, currentRoom: firstRoom}); self.setState({ready: true, currentRoom: firstRoom});
dis.dispatch({action: 'focus_composer'}); dis.dispatch({action: 'focus_composer'});
}); });
cli.on('Call.incoming', function(call) { cli.on('Call.incoming', function(call) {

View file

@ -50,24 +50,24 @@ module.exports = {
this.setStep("fetch_stages"); this.setStep("fetch_stages");
var cli = MatrixClientPeg.get(); var cli = MatrixClientPeg.get();
this.setState({busy: true}); this.setState({busy: true});
var that = this; var self = this;
cli.loginFlows().done(function(result) { cli.loginFlows().done(function(result) {
that.setState({ self.setState({
flows: result.flows, flows: result.flows,
currentStep: 1, currentStep: 1,
totalSteps: result.flows.length+1 totalSteps: result.flows.length+1
}); });
that.setStep('stage_'+result.flows[0].type); self.setStep('stage_'+result.flows[0].type);
}, function(error) { }, function(error) {
that.setStep("choose_hs"); self.setStep("choose_hs");
that.setState({errorText: 'Unable to contact the given Home Server'}); self.setState({errorText: 'Unable to contact the given Home Server'});
}); });
}, },
onUserPassEntered: function(ev) { onUserPassEntered: function(ev) {
ev.preventDefault(); ev.preventDefault();
this.setState({busy: true}); this.setState({busy: true});
var that = this; var self = this;
var formVals = this.getFormVals(); var formVals = this.getFormVals();
@ -77,8 +77,8 @@ module.exports = {
}).done(function(data) { }).done(function(data) {
// XXX: we assume this means we're logged in, but there could be a next stage // XXX: we assume this means we're logged in, but there could be a next stage
MatrixClientPeg.replace(Matrix.createClient({ MatrixClientPeg.replace(Matrix.createClient({
baseUrl: that.state.hs_url, baseUrl: self.state.hs_url,
idBaseUrl: that.state.is_url, idBaseUrl: self.state.is_url,
userId: data.user_id, userId: data.user_id,
accessToken: data.access_token accessToken: data.access_token
})); }));
@ -86,8 +86,8 @@ module.exports = {
if (localStorage) { if (localStorage) {
try { try {
localStorage.clear(); localStorage.clear();
localStorage.setItem("mx_hs_url", that.state.hs_url); localStorage.setItem("mx_hs_url", self.state.hs_url);
localStorage.setItem("mx_is_url", that.state.is_url); localStorage.setItem("mx_is_url", self.state.is_url);
localStorage.setItem("mx_user_id", data.user_id); localStorage.setItem("mx_user_id", data.user_id);
localStorage.setItem("mx_access_token", data.access_token); localStorage.setItem("mx_access_token", data.access_token);
} catch (e) { } catch (e) {
@ -96,12 +96,12 @@ module.exports = {
} else { } else {
console.warn("No local storage available: can't persist session!"); console.warn("No local storage available: can't persist session!");
} }
if (that.props.onLoggedIn) { if (self.props.onLoggedIn) {
that.props.onLoggedIn(); self.props.onLoggedIn();
} }
}, function(error) { }, function(error) {
that.setStep("stage_m.login.password"); self.setStep("stage_m.login.password");
that.setState({errorText: 'Login failed.'}); self.setState({errorText: 'Login failed.'});
}); });
}, },