Page MenuHomePhorge

D7522.1767257390.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D7522.1767257390.diff

diff --git a/lib/actions/link-actions.js b/lib/actions/link-actions.js
new file mode 100644
--- /dev/null
+++ b/lib/actions/link-actions.js
@@ -0,0 +1,33 @@
+// @flow
+
+import type {
+ InviteLinkVerificationRequest,
+ InviteLinkVerificationResponse,
+} from '../types/link-types.js';
+import type { CallServerEndpoint } from '../utils/call-server-endpoint.js';
+
+const verifyInviteLinkActionTypes = Object.freeze({
+ started: 'VERIFY_INVITE_LINK_STARTED',
+ success: 'VERIFY_INVITE_LINK_SUCCESS',
+ failed: 'VERIFY_INVITE_LINK_FAILED',
+});
+const verifyInviteLink =
+ (
+ callServerEndpoint: CallServerEndpoint,
+ ): ((
+ request: InviteLinkVerificationRequest,
+ ) => Promise<InviteLinkVerificationResponse>) =>
+ async request => {
+ const response = await callServerEndpoint('verify_invite_link', request);
+ if (response.status === 'valid' || response.status === 'already_joined') {
+ return {
+ status: response.status,
+ community: response.community,
+ };
+ }
+ return {
+ status: response.status,
+ };
+ };
+
+export { verifyInviteLinkActionTypes, verifyInviteLink };
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -33,6 +33,7 @@
SetCalendarDeletedFilterPayload,
} from './filter-types.js';
import type { LifecycleState } from './lifecycle-state-types.js';
+import type { InviteLinkVerificationResponse } from './link-types.js';
import type { LoadingStatus, LoadingInfo } from './loading-types.js';
import type { UpdateMultimediaMessageMediaPayload } from './media-types.js';
import type { MessageReportCreationResult } from './message-report-types.js';
@@ -988,6 +989,22 @@
+error: true,
+payload: Error,
+loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'VERIFY_INVITE_LINK_STARTED',
+ +loadingInfo?: LoadingInfo,
+ +payload?: void,
+ }
+ | {
+ +type: 'VERIFY_INVITE_LINK_SUCCESS',
+ +payload: InviteLinkVerificationResponse,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'VERIFY_INVITE_LINK_FAILED',
+ +error: true,
+ +payload: Error,
+ +loadingInfo: LoadingInfo,
};
export type ActionPayload = ?(Object | Array<*> | $ReadOnlyArray<*> | string);

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 1, 8:49 AM (13 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5875543
Default Alt Text
D7522.1767257390.diff (2 KB)

Event Timeline