edited for code style consistency
This commit is contained in:
@@ -76,7 +76,7 @@ class AccSecurityView extends React.Component {
|
||||
this.props.onShowAlert(
|
||||
formatMessage(messages.delete_account), // title
|
||||
formatMessage(messages.delete_account_warning), // content
|
||||
(() => { this.props.onDeleteAccount(); }), // onConfirm
|
||||
(_ => this.props.onDeleteAccount()), // onConfirm
|
||||
null, // use default text "OK"
|
||||
true, // Show Reject button
|
||||
null // use default text "Cancel"
|
||||
|
||||
@@ -410,11 +410,10 @@ class InfoView extends React.Component {
|
||||
}
|
||||
|
||||
const isMe = this.props.tinode.isMe(params.topicName);
|
||||
const menuItems = [
|
||||
{title: formatMessage(messages.edit_permissions), handler: () => {
|
||||
this.handleLaunchPermissionsEditor(isMe ? 'want' : 'user', params.topicName);
|
||||
}}
|
||||
];
|
||||
const menuItems = [{
|
||||
title: formatMessage(messages.edit_permissions),
|
||||
handler: _ => this.handleLaunchPermissionsEditor(isMe ? 'want' : 'user', params.topicName)
|
||||
}];
|
||||
if (!isMe) {
|
||||
menuItems.push('member_delete');
|
||||
}
|
||||
|
||||
+10
-13
@@ -400,7 +400,7 @@ class MessagesView extends React.Component {
|
||||
|
||||
const setQuery = newTopic ? this.props.newTopicParams : undefined;
|
||||
topic.subscribe(getQuery.build(), setQuery)
|
||||
.then((ctrl) => {
|
||||
.then(ctrl => {
|
||||
if (ctrl.code == 303) {
|
||||
// Redirect to another topic requested.
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic('', ctrl.params.topic));
|
||||
@@ -430,7 +430,7 @@ class MessagesView extends React.Component {
|
||||
topic.delMessagesList(calls, true);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
.catch(err => {
|
||||
console.error("Failed subscription to", this.state.topic, err);
|
||||
this.props.onError(err.message, 'err');
|
||||
const blankState = MessagesView.getDerivedStateFromProps({}, {});
|
||||
@@ -447,8 +447,8 @@ class MessagesView extends React.Component {
|
||||
const oldTopic = this.props.tinode.getTopic(oldTopicName);
|
||||
if (oldTopic && oldTopic.isSubscribed()) {
|
||||
oldTopic.leave(false)
|
||||
.catch(() => { /* do nothing here */ })
|
||||
.finally(() => {
|
||||
.catch(_ => { /* do nothing here */ })
|
||||
.finally(_ => {
|
||||
// We don't care if the request succeeded or failed.
|
||||
// The topic is dead regardless.
|
||||
this.setState({fetchingMessages: false});
|
||||
@@ -487,10 +487,10 @@ class MessagesView extends React.Component {
|
||||
if (event.target.scrollTop <= 0) {
|
||||
const topic = this.props.tinode.getTopic(this.state.topic);
|
||||
if (topic && topic.isSubscribed() && topic.msgHasMoreMessages()) {
|
||||
this.setState({fetchingMessages: true}, () => {
|
||||
this.setState({fetchingMessages: true}, _ => {
|
||||
topic.getMessagesPage(MESSAGES_PAGE)
|
||||
.catch((err) => this.props.onError(err.message, 'err'))
|
||||
.finally(() => this.setState({fetchingMessages: false}));
|
||||
.catch(err => this.props.onError(err.message, 'err'))
|
||||
.finally(_ => this.setState({fetchingMessages: false}));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -656,9 +656,7 @@ class MessagesView extends React.Component {
|
||||
switch (info.what) {
|
||||
case 'kp': {
|
||||
clearTimeout(this.keyPressTimer);
|
||||
this.keyPressTimer = setTimeout(() => {
|
||||
this.setState({typingIndicator: false});
|
||||
}, KEYPRESS_DELAY + 1000);
|
||||
this.keyPressTimer = setTimeout(_ => this.setState({typingIndicator: false}), KEYPRESS_DELAY + 1000);
|
||||
if (!this.state.typingIndicator) {
|
||||
this.setState({typingIndicator: true});
|
||||
}
|
||||
@@ -893,9 +891,8 @@ class MessagesView extends React.Component {
|
||||
}
|
||||
// Pass data and the uploader to the TinodeWeb.
|
||||
this.sendMessage(msg, uploadCompletionPromise, uploader);
|
||||
}).catch((err) => {
|
||||
this.props.onError(err, 'err');
|
||||
});
|
||||
})
|
||||
.catch(err => this.props.onError(err, 'err'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,7 @@ export default class PasswordResetView extends React.PureComponent {
|
||||
} else {
|
||||
const email = this.state.email.trim();
|
||||
this.setState({email: email});
|
||||
this.props.onRequest('email', email).then(() => {
|
||||
this.setState({sent: true});
|
||||
});
|
||||
this.props.onRequest('email', email).then(_ => this.setState({sent: true}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+74
-105
@@ -303,7 +303,7 @@ class TinodeWeb extends React.Component {
|
||||
if (this.state.desktopAlerts) {
|
||||
this.tinode.setDeviceToken(this.state.firebaseToken);
|
||||
}
|
||||
}).catch(() => {
|
||||
}).catch(_ => {
|
||||
// do nothing: handled earlier.
|
||||
// catch needed to pervent unnecessary logging of error.
|
||||
});
|
||||
@@ -322,7 +322,7 @@ class TinodeWeb extends React.Component {
|
||||
// When reading from storage, date is returned as string.
|
||||
token.expires = new Date(token.expires);
|
||||
this.tinode.setAuthToken(token);
|
||||
this.tinode.connect().catch((err) => {
|
||||
this.tinode.connect().catch(err => {
|
||||
// Socket error
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
@@ -400,7 +400,7 @@ class TinodeWeb extends React.Component {
|
||||
// (a) for channels always,
|
||||
// (b) pushes when the app is in foreground but has no focus.
|
||||
firebaseOnMessage(this.fcm, (payload) => { this.handlePushMessage(payload); });
|
||||
}).catch((err) => {
|
||||
}).catch(err => {
|
||||
// SW registration or FCM has failed :(
|
||||
onError(err);
|
||||
throw err;
|
||||
@@ -454,9 +454,9 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
// Check if a newer version of TinodeWeb app is available at the server.
|
||||
checkForAppUpdate(reg) {
|
||||
reg.onupdatefound = () => {
|
||||
reg.onupdatefound = _ => {
|
||||
const installingWorker = reg.installing;
|
||||
installingWorker.onstatechange = () => {
|
||||
installingWorker.onstatechange = _ => {
|
||||
if (installingWorker.state == 'installed' && navigator.serviceWorker.controller) {
|
||||
const msg = <>
|
||||
<FormattedMessage id="update_available"
|
||||
@@ -570,7 +570,7 @@ class TinodeWeb extends React.Component {
|
||||
if (this.tinode.isConnected()) {
|
||||
this.doLogin(login, password, null, {meth: this.state.credMethod, resp: this.state.credCode});
|
||||
} else {
|
||||
this.tinode.connect().catch((err) => {
|
||||
this.tinode.connect().catch(err => {
|
||||
// Socket error
|
||||
this.setState({loginDisabled: false, autoLogin: false, loadSpinnerVisible: false});
|
||||
this.handleError(err.message, 'err');
|
||||
@@ -581,12 +581,12 @@ class TinodeWeb extends React.Component {
|
||||
// Enable or disable saving the password and IndexedDB.
|
||||
handlePersistenceChange(persist) {
|
||||
if (persist) {
|
||||
this.tinode.initStorage().then(() => {
|
||||
this.tinode.initStorage().then(_ => {
|
||||
LocalStorageUtil.setObject('keep-logged-in', true);
|
||||
this.setState({persist: true});
|
||||
});
|
||||
} else {
|
||||
this.tinode.clearStorage().then(() => {
|
||||
this.tinode.clearStorage().then(_ => {
|
||||
LocalStorageUtil.setObject('keep-logged-in', false);
|
||||
this.setState({persist: false});
|
||||
});
|
||||
@@ -625,7 +625,7 @@ class TinodeWeb extends React.Component {
|
||||
prom.then(_ => {
|
||||
// Reconnected: clear error
|
||||
this.handleError();
|
||||
}).catch((err) => {
|
||||
}).catch(err => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
return;
|
||||
@@ -701,7 +701,7 @@ class TinodeWeb extends React.Component {
|
||||
loginPromise = connectionPromise.then(_ => this.tinode.loginToken(token, cred));
|
||||
}
|
||||
|
||||
loginPromise.then((ctrl) => {
|
||||
loginPromise.then(ctrl => {
|
||||
if (ctrl.code >= 300 && ctrl.text === 'validate credentials') {
|
||||
this.setState({loadSpinnerVisible: false});
|
||||
if (cred) {
|
||||
@@ -711,7 +711,7 @@ class TinodeWeb extends React.Component {
|
||||
} else {
|
||||
this.handleLoginSuccessful();
|
||||
}
|
||||
}).catch((err) => {
|
||||
}).catch(err => {
|
||||
// Connection or login failed, report error.
|
||||
this.setState({
|
||||
loginDisabled: false,
|
||||
@@ -768,12 +768,12 @@ class TinodeWeb extends React.Component {
|
||||
withTags().
|
||||
withCred().
|
||||
build()
|
||||
).catch((err) => {
|
||||
).catch(err => {
|
||||
this.tinode.disconnect();
|
||||
localStorage.removeItem('auth-token');
|
||||
this.handleError(err.message, 'err');
|
||||
HashNavigation.navigateTo('');
|
||||
}).finally(() => {
|
||||
}).finally(_ => {
|
||||
this.setState({loadSpinnerVisible: false});
|
||||
});
|
||||
let urlHash = HashNavigation.setUrlSidePanel(window.location.hash, 'contacts');
|
||||
@@ -934,7 +934,7 @@ class TinodeWeb extends React.Component {
|
||||
if (fnd.isSubscribed()) {
|
||||
this.tnFndSubsUpdated();
|
||||
} else {
|
||||
fnd.subscribe(fnd.startMetaQuery().withSub().build()).catch((err) => {
|
||||
fnd.subscribe(fnd.startMetaQuery().withSub().build()).catch(err => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
}
|
||||
@@ -957,11 +957,9 @@ class TinodeWeb extends React.Component {
|
||||
*/
|
||||
handleSearchContacts(query) {
|
||||
const fnd = this.tinode.getFndTopic();
|
||||
fnd.setMeta({desc: {public: query}}).then((ctrl) => {
|
||||
return fnd.getMeta(fnd.startMetaQuery().withSub().build());
|
||||
}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
fnd.setMeta({desc: {public: query}})
|
||||
.then(_ => fnd.getMeta(fnd.startMetaQuery().withSub().build()))
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
// User clicked on a topic in the side panel or deleted a topic.
|
||||
@@ -1043,7 +1041,7 @@ class TinodeWeb extends React.Component {
|
||||
// Topic is not subscribed yet. Subscribe.
|
||||
const subscribePromise =
|
||||
topic.subscribe()
|
||||
.then(() => {
|
||||
.then(_ => {
|
||||
// If there are unsent messages (except video call messages),
|
||||
// try sending them now. Unsent video call messages will be dropped.
|
||||
let calls = [];
|
||||
@@ -1069,15 +1067,13 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
// TODO: check if return is required.
|
||||
return topic.publishDraft(msg, Promise.all(completion))
|
||||
.then((ctrl) => {
|
||||
.then(ctrl => {
|
||||
if (topic.isArchived()) {
|
||||
topic.archive(false);
|
||||
}
|
||||
return ctrl;
|
||||
})
|
||||
.catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
handleNewChatInvitation(topicName, action) {
|
||||
@@ -1091,9 +1087,7 @@ class TinodeWeb extends React.Component {
|
||||
if (topic.isP2PType()) {
|
||||
// For P2P topics change 'given' permission of the peer too.
|
||||
// In p2p topics the other user has the same name as the topic.
|
||||
response = response.then((ctrl) => {
|
||||
topic.setMeta({sub: {user: topicName, mode: mode}});
|
||||
});
|
||||
response = response.then(_ => topic.setMeta({sub: {user: topicName, mode: mode}}));
|
||||
}
|
||||
break;
|
||||
case 'delete':
|
||||
@@ -1104,18 +1098,14 @@ class TinodeWeb extends React.Component {
|
||||
// Ban the topic making futher invites impossible.
|
||||
// Just self-ban.
|
||||
const am = topic.getAccessMode().updateWant('-JP').getWant();
|
||||
response = topic.setMeta({sub: {mode: am}}).then((ctrl) => {
|
||||
return this.handleTopicSelected(null);
|
||||
});
|
||||
response = topic.setMeta({sub: {mode: am}}).then(_ => this.handleTopicSelected(null));
|
||||
break;
|
||||
default:
|
||||
console.warn("Unknown invitation action", '"' + action + '""');
|
||||
}
|
||||
|
||||
if (response != null) {
|
||||
response.catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
response.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1156,7 +1146,7 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
const me = this.tinode.getMeTopic();
|
||||
const am = me.getAccessMode().updateWant(on ? '-P' : '+P').getWant();
|
||||
me.setMeta({sub: {mode: am}}).catch((err) => {
|
||||
me.setMeta({sub: {mode: am}}).catch(err => {
|
||||
// Request failed, keep existing state.
|
||||
this.setState({incognitoMode: !on});
|
||||
this.handleError(err.message, 'err');
|
||||
@@ -1165,9 +1155,7 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
handleUpdateAccountTagsRequest(tags) {
|
||||
this.tinode.getMeTopic().setMeta({tags: tags})
|
||||
.catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
// User chose Settings menu item.
|
||||
@@ -1235,9 +1223,9 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
}
|
||||
} else if (this.state.firebaseToken && this.fcm) {
|
||||
firebaseDelToken(this.fcm).catch((err) => {
|
||||
firebaseDelToken(this.fcm).catch(err => {
|
||||
console.error("Unable to delete token.", err);
|
||||
}).finally(() => {
|
||||
}).finally(_ => {
|
||||
LocalStorageUtil.updateObject('settings', {desktopAlerts: false});
|
||||
localStorage.removeItem('firebase-token');
|
||||
this.setState({desktopAlerts: false, firebaseToken: null});
|
||||
@@ -1259,16 +1247,14 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
handleCredAdd(method, value) {
|
||||
const me = this.tinode.getMeTopic();
|
||||
me.setMeta({cred: {meth: method, val: value}}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
me.setMeta({cred: {meth: method, val: value}})
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
handleCredDelete(method, value) {
|
||||
const me = this.tinode.getMeTopic();
|
||||
me.delCredential(method, value).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
me.delCredential(method, value)
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
handleCredConfirm(method, response) {
|
||||
@@ -1332,7 +1318,7 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
}
|
||||
params._topicName = topicName;
|
||||
this.setState({newTopicParams: params}, () => {this.handleTopicSelected(topicName)});
|
||||
this.setState({newTopicParams: params}, _ => {this.handleTopicSelected(topicName)});
|
||||
}
|
||||
|
||||
// New topic was created, here is the new topic name.
|
||||
@@ -1377,18 +1363,15 @@ class TinodeWeb extends React.Component {
|
||||
if (defacs) {
|
||||
params.defacs = defacs;
|
||||
}
|
||||
topic.setMeta({desc: params, attachments: attachments}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.setMeta({desc: params, attachments: attachments})
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
}
|
||||
|
||||
handleUnarchive(topicName) {
|
||||
const topic = this.tinode.getTopic(topicName);
|
||||
if (topic) {
|
||||
topic.archive(false).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.archive(false).catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1396,9 +1379,8 @@ class TinodeWeb extends React.Component {
|
||||
this.handleError();
|
||||
|
||||
if (password) {
|
||||
this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password)
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1413,18 +1395,16 @@ class TinodeWeb extends React.Component {
|
||||
am.updateWant(mode);
|
||||
mode = am.getWant();
|
||||
}
|
||||
topic.setMeta({sub: {user: uid, mode: mode}}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.setMeta({sub: {user: uid, mode: mode}})
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
}
|
||||
|
||||
handleTagsUpdateRequest(topicName, tags) {
|
||||
const topic = this.tinode.getTopic(topicName);
|
||||
if (topic) {
|
||||
topic.setMeta({tags: tags}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.setMeta({tags: tags})
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1451,9 +1431,9 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
this.setState(this.getBlankState());
|
||||
|
||||
cleared.then(() => {
|
||||
cleared.then(_ => {
|
||||
this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, isSecureConnection(),
|
||||
this.state.transport, this.props.intl.locale, LocalStorageUtil.getObject('keep-logged-in'), () => {
|
||||
this.state.transport, this.props.intl.locale, LocalStorageUtil.getObject('keep-logged-in'), _ => {
|
||||
this.tinode.onConnect = this.handleConnected;
|
||||
this.tinode.onDisconnect = this.handleDisconnect;
|
||||
this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;
|
||||
@@ -1477,10 +1457,10 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
|
||||
// Request to hard-delete topic.
|
||||
topic.delTopic(true).then((ctrl) => {
|
||||
topic.delTopic(true).then(_ => {
|
||||
// Hide MessagesView and InfoView panels.
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||
}).catch((err) => {
|
||||
}).catch(err => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
}
|
||||
@@ -1492,9 +1472,8 @@ class TinodeWeb extends React.Component {
|
||||
}
|
||||
|
||||
// Request hard-delete all messages.
|
||||
topic.delMessagesAll(true).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.delMessagesAll(true)
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
handleLeaveUnsubRequest(topicName) {
|
||||
@@ -1503,10 +1482,10 @@ class TinodeWeb extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
topic.leave(true).then((ctrl) => {
|
||||
topic.leave(true).then(_ => {
|
||||
// Hide MessagesView and InfoView panels.
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||
}).catch((err) => {
|
||||
}).catch(err => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
}
|
||||
@@ -1517,12 +1496,12 @@ class TinodeWeb extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
topic.updateMode(null, '-JP').then(_ => {
|
||||
// Hide MessagesView and InfoView panels.
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||
}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.updateMode(null, '-JP')
|
||||
.then(_ => {
|
||||
// Hide MessagesView and InfoView panels.
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||
})
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
handleReportTopic(topicName) {
|
||||
@@ -1535,12 +1514,12 @@ class TinodeWeb extends React.Component {
|
||||
this.tinode.report('report', topicName);
|
||||
|
||||
// Remove J and P permissions.
|
||||
topic.updateMode(null, '-JP').then((ctrl) => {
|
||||
topic.updateMode(null, '-JP')
|
||||
.then(_ => {
|
||||
// Hide MessagesView and InfoView panels.
|
||||
HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));
|
||||
}).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
})
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
}
|
||||
|
||||
handleShowContextMenu(params, menuItems) {
|
||||
@@ -1637,7 +1616,7 @@ class TinodeWeb extends React.Component {
|
||||
handleContextMenuAction(action, promise, params) {
|
||||
if (action == 'topic_archive') {
|
||||
if (promise && params.topicName && params.topicName == this.state.topicSelected) {
|
||||
promise.then(() => {
|
||||
promise.then(_ => {
|
||||
this.handleTopicSelected(null);
|
||||
});
|
||||
}
|
||||
@@ -1677,17 +1656,15 @@ class TinodeWeb extends React.Component {
|
||||
|
||||
if (added && added.length > 0) {
|
||||
added.map((uid) => {
|
||||
topic.invite(uid, null).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.invite(uid, null)
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
});
|
||||
}
|
||||
|
||||
if (removed && removed.length > 0) {
|
||||
removed.map((uid) => {
|
||||
topic.delSubscription(uid).catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
topic.delSubscription(uid)
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1696,9 +1673,7 @@ class TinodeWeb extends React.Component {
|
||||
if (this.tinode.isAuthenticated()) {
|
||||
// Adding new email or phone number in account setting.
|
||||
this.tinode.getMeTopic().setMeta({cred: {meth: cred, resp: code}})
|
||||
.catch((err) => {
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
.catch(err => this.handleError(err.message, 'err'));
|
||||
} else {
|
||||
// Credential validation on signup.
|
||||
this.setState({credMethod: cred, credCode: code, credToken: token});
|
||||
@@ -1709,10 +1684,8 @@ class TinodeWeb extends React.Component {
|
||||
handlePasswordResetRequest(method, value) {
|
||||
// If already connected, connnect() will return a resolved promise.
|
||||
return this.tinode.connect()
|
||||
.then(() => {
|
||||
return this.tinode.requestResetAuthSecret('basic', method, value);
|
||||
})
|
||||
.catch((err) => {
|
||||
.then(_ => this.tinode.requestResetAuthSecret('basic', method, value))
|
||||
.catch(err => {
|
||||
// Socket error
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
@@ -1724,13 +1697,9 @@ class TinodeWeb extends React.Component {
|
||||
this.handleError(this.props.intl.formatMessage(messages.invalid_security_token), 'err');
|
||||
} else {
|
||||
this.tinode.connect()
|
||||
.then(() => {
|
||||
return this.tinode.updateAccountBasic(null, null, newPassword, {token: token});
|
||||
})
|
||||
.then(() => {
|
||||
HashNavigation.navigateTo('');
|
||||
})
|
||||
.catch((err) => {
|
||||
.then(_ => this.tinode.updateAccountBasic(null, null, newPassword, {token: token}))
|
||||
.then(_ => HashNavigation.navigateTo(''))
|
||||
.catch(err => {
|
||||
// Socket error
|
||||
this.handleError(err.message, 'err');
|
||||
});
|
||||
@@ -1749,7 +1718,7 @@ class TinodeWeb extends React.Component {
|
||||
case CALL_STATE_OUTGOING_INITATED:
|
||||
let head = { webrtc: CALL_HEAD_STARTED };
|
||||
this.handleSendMessage(Drafty.videoCall(), undefined, undefined, head)
|
||||
.then((ctrl) => {
|
||||
.then(ctrl => {
|
||||
if (ctrl.code < 200 || ctrl.code >= 300 || !ctrl.params || !ctrl.params.seq) {
|
||||
this.handleCallClose();
|
||||
return;
|
||||
@@ -1836,7 +1805,7 @@ class TinodeWeb extends React.Component {
|
||||
// We need to switch and subscribe to callTopic first.
|
||||
this.setState({
|
||||
callShouldStart: true,
|
||||
}, () => this.handleTopicSelected(this.state.callTopic));
|
||||
}, _ => this.handleTopicSelected(this.state.callTopic));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1955,9 +1924,9 @@ class TinodeWeb extends React.Component {
|
||||
visible={this.state.alertVisible}
|
||||
title={this.state.alertParams.title}
|
||||
content={this.state.alertParams.content}
|
||||
onReject={this.state.alertParams.onReject ? (() => { this.setState({alertVisible: false}); }) : null}
|
||||
onReject={this.state.alertParams.onReject ? (_ => this.setState({alertVisible: false})) : null}
|
||||
reject={this.state.alertParams.reject}
|
||||
onConfirm={() => { this.setState({alertVisible: false}); this.state.alertParams.onConfirm(); }}
|
||||
onConfirm={_ => {this.setState({alertVisible: false}); this.state.alertParams.onConfirm();}}
|
||||
confirm={this.state.alertParams.confirm}
|
||||
/>
|
||||
<SidepanelView
|
||||
|
||||
Reference in New Issue
Block a user