Page MenuHomePhabricator

D13992.id45977.diff
No OneTemporary

D13992.id45977.diff

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

Mime Type
text/plain
Expires
Sat, Nov 30, 1:35 PM (20 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2598323
Default Alt Text
D13992.id45977.diff (4 KB)

Event Timeline