You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-06 12:02:40 +03:00
tidy a bit more
This commit is contained in:
@@ -218,14 +218,13 @@ export class InteractiveAuth {
|
|||||||
// This promise will be quite long-lived and will resolve when the
|
// This promise will be quite long-lived and will resolve when the
|
||||||
// request is authenticated and completes successfully.
|
// request is authenticated and completes successfully.
|
||||||
this.attemptAuthDeferred = defer();
|
this.attemptAuthDeferred = defer();
|
||||||
|
// pluck the promise out now, as doRequest may clear before we return
|
||||||
const promise = this.attemptAuthDeferred.promise;
|
const promise = this.attemptAuthDeferred.promise;
|
||||||
|
|
||||||
const hasFlows = this.data && this.data.flows;
|
|
||||||
|
|
||||||
// if we have no flows, try a request to acquire the flows
|
// if we have no flows, try a request to acquire the flows
|
||||||
if (!hasFlows) {
|
if (!this.data?.flows) {
|
||||||
this.busyChangedCallback?.(true);
|
this.busyChangedCallback?.(true);
|
||||||
// use the existing sessionid, if one is present.
|
// use the existing sessionId, if one is present.
|
||||||
let auth = null;
|
let auth = null;
|
||||||
if (this.data.session) {
|
if (this.data.session) {
|
||||||
auth = {
|
auth = {
|
||||||
@@ -412,7 +411,7 @@ export class InteractiveAuth {
|
|||||||
this.attemptAuthDeferred = null;
|
this.attemptAuthDeferred = null;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// sometimes UI auth errors don't come with flows
|
// sometimes UI auth errors don't come with flows
|
||||||
const errorFlows = error.data ? error.data.flows : null;
|
const errorFlows = error.data?.flows ?? null;
|
||||||
const haveFlows = this.data.flows || Boolean(errorFlows);
|
const haveFlows = this.data.flows || Boolean(errorFlows);
|
||||||
if (error.httpStatus !== 401 || !error.data || !haveFlows) {
|
if (error.httpStatus !== 401 || !error.data || !haveFlows) {
|
||||||
// doesn't look like an interactive-auth failure.
|
// doesn't look like an interactive-auth failure.
|
||||||
|
@@ -1067,8 +1067,8 @@ export class SyncApi {
|
|||||||
// will be updated when we receive push rules via getPushRules
|
// will be updated when we receive push rules via getPushRules
|
||||||
// (see sync) before syncing over the network.
|
// (see sync) before syncing over the network.
|
||||||
if (accountDataEvent.getType() === EventType.PushRules) {
|
if (accountDataEvent.getType() === EventType.PushRules) {
|
||||||
const rules = accountDataEvent.getContent();
|
const rules = accountDataEvent.getContent<IRulesets>();
|
||||||
client.pushRules = PushProcessor.rewriteDefaultRules(rules as IRulesets);
|
client.pushRules = PushProcessor.rewriteDefaultRules(rules);
|
||||||
}
|
}
|
||||||
const prevEvent = prevEventsMap[accountDataEvent.getId()];
|
const prevEvent = prevEventsMap[accountDataEvent.getId()];
|
||||||
client.emit("accountData", accountDataEvent, prevEvent);
|
client.emit("accountData", accountDataEvent, prevEvent);
|
||||||
|
Reference in New Issue
Block a user