Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into t3chguy/reset_favicon_on_logout

This commit is contained in:
Michael Telatynski 2017-06-20 18:39:59 +01:00
commit 7f6a252bcb
4 changed files with 16 additions and 13 deletions

View File

@ -156,7 +156,7 @@ export function attemptTokenLogin(queryParams, defaultDeviceDisplayName) {
} }
function _registerAsGuest(hsUrl, isUrl, defaultDeviceDisplayName) { function _registerAsGuest(hsUrl, isUrl, defaultDeviceDisplayName) {
console.log("Doing guest login on %s", hsUrl); console.log(`Doing guest login on ${hsUrl}`);
// TODO: we should probably de-duplicate this and Login.loginAsGuest. // TODO: we should probably de-duplicate this and Login.loginAsGuest.
// Not really sure where the right home for it is. // Not really sure where the right home for it is.
@ -171,7 +171,7 @@ function _registerAsGuest(hsUrl, isUrl, defaultDeviceDisplayName) {
initial_device_display_name: defaultDeviceDisplayName, initial_device_display_name: defaultDeviceDisplayName,
}, },
}).then((creds) => { }).then((creds) => {
console.log("Registered as guest: %s", creds.user_id); console.log(`Registered as guest: ${creds.user_id}`);
return _doSetLoggedIn({ return _doSetLoggedIn({
userId: creds.user_id, userId: creds.user_id,
deviceId: creds.device_id, deviceId: creds.device_id,
@ -215,7 +215,7 @@ function _restoreFromLocalStorage() {
} }
if (accessToken && userId && hsUrl) { if (accessToken && userId && hsUrl) {
console.log("Restoring session for %s", userId); console.log(`Restoring session for ${userId}`);
try { try {
return _doSetLoggedIn({ return _doSetLoggedIn({
userId: userId, userId: userId,
@ -315,10 +315,10 @@ async function _doSetLoggedIn(credentials, clearStorage) {
credentials.guest = Boolean(credentials.guest); credentials.guest = Boolean(credentials.guest);
console.log( console.log(
"setLoggedIn: mxid:", credentials.userId, "setLoggedIn: mxid: " + credentials.userId +
"deviceId:", credentials.deviceId, " deviceId: " + credentials.deviceId +
"guest:", credentials.guest, " guest: " + credentials.guest +
"hs:", credentials.homeserverUrl, " hs: " + credentials.homeserverUrl,
); );
// This is dispatched to indicate that the user is still in the process of logging in // This is dispatched to indicate that the user is still in the process of logging in
@ -395,7 +395,7 @@ function _persistCredentialsToLocalStorage(credentials) {
localStorage.setItem("mx_device_id", credentials.deviceId); localStorage.setItem("mx_device_id", credentials.deviceId);
} }
console.log("Session persisted for %s", credentials.userId); console.log(`Session persisted for ${credentials.userId}`);
} }
/** /**

View File

@ -84,7 +84,9 @@ class MatrixClientPeg {
let promise = this.matrixClient.store.startup(); let promise = this.matrixClient.store.startup();
// log any errors when starting up the database (if one exists) // log any errors when starting up the database (if one exists)
promise.catch((err) => { console.error(err); }); promise.catch((err) => {
console.error(`Error starting matrixclient store: ${err}`);
});
// regardless of errors, start the client. If we did error out, we'll // regardless of errors, start the client. If we did error out, we'll
// just end up doing a full initial /sync. // just end up doing a full initial /sync.

View File

@ -330,7 +330,7 @@ module.exports = React.createClass({
defaultDeviceDisplayName: this.props.defaultDeviceDisplayName, defaultDeviceDisplayName: this.props.defaultDeviceDisplayName,
}); });
}).catch((e) => { }).catch((e) => {
console.error("Unable to load session", e); console.error(`Error attempting to load session from token params: ${e}`);
return false; return false;
}).then((loadedSession) => { }).then((loadedSession) => {
if (!loadedSession) { if (!loadedSession) {

View File

@ -178,7 +178,7 @@ module.exports = React.createClass({
}, },
onQueryChanged: function(ev) { onQueryChanged: function(ev) {
const query = ev.target.value.toLowerCase(); const query = ev.target.value;
if (this.queryChangedDebouncer) { if (this.queryChangedDebouncer) {
clearTimeout(this.queryChangedDebouncer); clearTimeout(this.queryChangedDebouncer);
} }
@ -271,10 +271,11 @@ module.exports = React.createClass({
query, query,
searchError: null, searchError: null,
}); });
const queryLowercase = query.toLowerCase();
const results = []; const results = [];
MatrixClientPeg.get().getUsers().forEach((user) => { MatrixClientPeg.get().getUsers().forEach((user) => {
if (user.userId.toLowerCase().indexOf(query) === -1 && if (user.userId.toLowerCase().indexOf(queryLowercase) === -1 &&
user.displayName.toLowerCase().indexOf(query) === -1 user.displayName.toLowerCase().indexOf(queryLowercase) === -1
) { ) {
return; return;
} }