Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3333752
D13992.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D13992.diff
View Options
diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -19,6 +19,7 @@
updateMultimediaMessageMediaActionType,
useBlobServiceUpload,
} from 'lib/actions/upload-actions.js';
+import { useInvalidCSATLogOut } from 'lib/actions/user-actions.js';
import {
type SendMultimediaMessagePayload,
useInputStateContainerSendMultimediaMessage,
@@ -158,6 +159,7 @@
) => Promise<NewThreadResult>,
+newThickThread: (request: NewThickThreadRequest) => Promise<string>,
+textMessageCreationSideEffectsFunc: CreationSideEffectsFunc<RawTextMessageInfo>,
+ +invalidTokenLogOut: () => Promise<void>,
};
type State = {
+pendingUploads: PendingMultimediaUploads,
@@ -915,6 +917,10 @@
mediaMissionResult = { success: true };
} catch (e) {
uploadExceptionMessage = getMessageForException(e);
+ if (uploadExceptionMessage === 'invalid_csat') {
+ void this.props.invalidTokenLogOut();
+ return undefined;
+ }
onUploadFailed('upload failed');
mediaMissionResult = {
success: false,
@@ -1709,6 +1715,7 @@
const staffCanSee = useStaffCanSee();
const textMessageCreationSideEffectsFunc =
useMessageCreationSideEffectsFunc<RawTextMessageInfo>(messageTypes.TEXT);
+ const callInvalidTokenLogOut = useInvalidCSATLogOut();
return (
<InputStateContainer
@@ -1728,6 +1735,7 @@
dispatch={dispatch}
staffCanSee={staffCanSee}
textMessageCreationSideEffectsFunc={textMessageCreationSideEffectsFunc}
+ invalidTokenLogOut={callInvalidTokenLogOut}
/>
);
});
diff --git a/web/input/input-state-container.react.js b/web/input/input-state-container.react.js
--- a/web/input/input-state-container.react.js
+++ b/web/input/input-state-container.react.js
@@ -24,6 +24,7 @@
useBlobServiceUpload,
useDeleteUpload,
} from 'lib/actions/upload-actions.js';
+import { useInvalidCSATLogOut } from 'lib/actions/user-actions.js';
import {
type PushModal,
useModalContext,
@@ -157,6 +158,7 @@
+unregisterSendCallback: (() => mixed) => void,
+textMessageCreationSideEffectsFunc: CreationSideEffectsFunc<RawTextMessageInfo>,
+identityContext: ?IdentityClientContextType,
+ +invalidTokenLogOut: () => Promise<void>,
};
type WritableState = {
pendingUploads: {
@@ -931,6 +933,10 @@
});
} catch (e) {
uploadExceptionMessage = getMessageForException(e);
+ if (uploadExceptionMessage === 'invalid_csat') {
+ void this.props.invalidTokenLogOut();
+ return;
+ }
this.handleUploadFailure(threadID, localID);
}
userTime = Date.now() - selectTime;
@@ -1203,7 +1209,7 @@
});
}
if (isBlobServiceURI(pendingUpload.uri)) {
- const identityContext = this.props.identityContext;
+ const { invalidTokenLogOut, identityContext } = this.props;
invariant(identityContext, 'Identity context should be set');
invariant(
pendingUpload.blobHolder,
@@ -1215,7 +1221,13 @@
const authMetadata = await identityContext.getAuthMetadata();
const defaultHeaders =
createDefaultHTTPRequestHeaders(authMetadata);
- await removeBlobHolder({ blobHash, holder }, defaultHeaders);
+ const result = await removeBlobHolder(
+ { blobHash, holder },
+ defaultHeaders,
+ );
+ if (!result.success && result.reason === 'INVALID_CSAT') {
+ void invalidTokenLogOut();
+ }
})();
}
}
@@ -1664,6 +1676,7 @@
const dispatchActionPromise = useDispatchActionPromise();
const modalContext = useModalContext();
const identityContext = React.useContext(IdentityClientContext);
+ const callInvalidTokenLogOut = useInvalidCSATLogOut();
const [sendCallbacks, setSendCallbacks] = React.useState<
$ReadOnlyArray<() => mixed>,
@@ -1705,6 +1718,7 @@
unregisterSendCallback={unregisterSendCallback}
textMessageCreationSideEffectsFunc={textMessageCreationSideEffectsFunc}
identityContext={identityContext}
+ invalidTokenLogOut={callInvalidTokenLogOut}
/>
);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 5:14 AM (19 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2560056
Default Alt Text
D13992.diff (4 KB)
Attached To
Mode
D13992: [native][web] Handle invalid CSAT in input-state-containers
Attached
Detach File
Event Timeline
Log In to Comment