Page MenuHomePhabricator

D5827.id19180.diff
No OneTemporary

D5827.id19180.diff

diff --git a/lib/socket/socket.react.js b/lib/socket/socket.react.js
--- a/lib/socket/socket.react.js
+++ b/lib/socket/socket.react.js
@@ -15,6 +15,7 @@
} from '../shared/timeouts';
import { logInActionSources, type LogOutResult } from '../types/account-types';
import type { CalendarQuery } from '../types/entry-types';
+import { forcePolicyAcknowledgmentActionType } from '../types/policy-types.js';
import type { Dispatch } from '../types/redux-types';
import {
serverRequestTypes,
@@ -442,6 +443,12 @@
} else {
console.log(`socket sent error ${errorMessage}`);
}
+ if (errorMessage === 'policies_not_accepted') {
+ this.props.dispatch({
+ type: forcePolicyAcknowledgmentActionType,
+ payload,
+ });
+ }
} else if (message.type === serverSocketMessageTypes.AUTH_ERROR) {
const { sessionChange } = message;
const cookie = sessionChange ? sessionChange.cookie : this.props.cookie;
diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js
--- a/lib/utils/action-utils.js
+++ b/lib/utils/action-utils.js
@@ -211,6 +211,7 @@
endpoint,
data,
options,
+ dispatch,
);
if (callServerEndpointCallback) {
callServerEndpointCallback(!!newSessionChange);
@@ -352,6 +353,7 @@
endpoint,
data,
options,
+ dispatch,
);
}
diff --git a/lib/utils/call-server-endpoint.js b/lib/utils/call-server-endpoint.js
--- a/lib/utils/call-server-endpoint.js
+++ b/lib/utils/call-server-endpoint.js
@@ -9,6 +9,8 @@
endpointIsSocketPreferred,
endpointIsSocketOnly,
} from '../types/endpoints';
+import { forcePolicyAcknowledgmentActionType } from '../types/policy-types.js';
+import type { Dispatch } from '../types/redux-types.js';
import type {
ServerSessionChange,
ClientSessionChange,
@@ -83,6 +85,7 @@
endpoint: Endpoint,
input: { [key: string]: mixed },
options?: ?CallServerEndpointOptions,
+ dispatch: Dispatch,
): Promise<Object> {
const possibleReplacement = await waitIfCookieInvalidated();
if (possibleReplacement) {
@@ -196,6 +199,13 @@
}
if (error) {
+ if (error === 'policies_not_accepted') {
+ dispatch({
+ type: forcePolicyAcknowledgmentActionType,
+ payload,
+ });
+ return;
+ }
throw new ServerError(error, payload);
}
options?.getResultInfo?.({ interface: 'REST' });

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 4:52 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678043
Default Alt Text
D5827.id19180.diff (2 KB)

Event Timeline