Don't clear MAU toasts when a successful sync comes in
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
030cc5cdea
commit
9c417cfbad
|
@ -92,12 +92,23 @@ interface IProps {
|
||||||
currentGroupIsNew?: boolean;
|
currentGroupIsNew?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IUsageLimit {
|
||||||
|
limit_type: "monthly_active_user" | "hs_disabled" | string;
|
||||||
|
admin_contact?: string;
|
||||||
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
mouseDown?: {
|
mouseDown?: {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
};
|
};
|
||||||
syncErrorData: any;
|
syncErrorData?: {
|
||||||
|
error: {
|
||||||
|
data: IUsageLimit;
|
||||||
|
errcode: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
usageLimitEventContent?: IUsageLimit;
|
||||||
useCompactLayout: boolean;
|
useCompactLayout: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +293,7 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
|
||||||
if (oldSyncState === 'PREPARED' && syncState === 'SYNCING') {
|
if (oldSyncState === 'PREPARED' && syncState === 'SYNCING') {
|
||||||
this._updateServerNoticeEvents();
|
this._updateServerNoticeEvents();
|
||||||
} else {
|
} else {
|
||||||
this._calculateServerLimitToast(data);
|
this._calculateServerLimitToast(this.state.syncErrorData, this.state.usageLimitEventContent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -293,7 +304,7 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_calculateServerLimitToast(syncErrorData, usageLimitEventContent?) {
|
_calculateServerLimitToast(syncErrorData: IState["syncErrorData"], usageLimitEventContent?: IUsageLimit) {
|
||||||
const error = syncErrorData && syncErrorData.error && syncErrorData.error.errcode === "M_RESOURCE_LIMIT_EXCEEDED";
|
const error = syncErrorData && syncErrorData.error && syncErrorData.error.errcode === "M_RESOURCE_LIMIT_EXCEEDED";
|
||||||
if (error) {
|
if (error) {
|
||||||
usageLimitEventContent = syncErrorData.error.data;
|
usageLimitEventContent = syncErrorData.error.data;
|
||||||
|
@ -330,8 +341,9 @@ class LoggedInView extends React.PureComponent<IProps, IState> {
|
||||||
e.getContent()['server_notice_type'] === 'm.server_notice.usage_limit_reached'
|
e.getContent()['server_notice_type'] === 'm.server_notice.usage_limit_reached'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
const usageLimitEventContent = usageLimitEvent && usageLimitEvent.getContent();
|
||||||
this._calculateServerLimitToast(this.state.syncErrorData, usageLimitEvent && usageLimitEvent.getContent());
|
this._calculateServerLimitToast(this.state.syncErrorData, usageLimitEventContent);
|
||||||
|
this.setState({ usageLimitEventContent });
|
||||||
};
|
};
|
||||||
|
|
||||||
_onPaste = (ev) => {
|
_onPaste = (ev) => {
|
||||||
|
|
Loading…
Reference in New Issue