Page MenuHomePhorge

D6531.1765087549.diff
No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None

D6531.1765087549.diff

diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -42,6 +42,7 @@
threadUpdateResponder,
threadCreationResponder,
threadJoinResponder,
+ threadFetchMediaResponder,
} from './responders/thread-responders';
import {
userSubscriptionUpdateResponder,
@@ -133,6 +134,10 @@
responder: messageFetchResponder,
requiredPolicies: baseLegalPolicies,
},
+ fetch_thread_media: {
+ responder: threadFetchMediaResponder,
+ requiredPolicies: baseLegalPolicies,
+ },
get_session_public_keys: {
responder: getSessionPublicKeysResponder,
requiredPolicies: baseLegalPolicies,
diff --git a/keyserver/src/responders/thread-responders.js b/keyserver/src/responders/thread-responders.js
--- a/keyserver/src/responders/thread-responders.js
+++ b/keyserver/src/responders/thread-responders.js
@@ -3,6 +3,7 @@
import t from 'tcomb';
import type { TUnion, TInterface } from 'tcomb';
+import type { Media } from 'lib/types/media-types';
import {
type ThreadDeletionRequest,
type RoleChangeRequest,
@@ -15,6 +16,7 @@
type NewThreadResponse,
type ServerThreadJoinRequest,
type ThreadJoinResult,
+ type ThreadFetchMediaRequest,
threadTypes,
} from 'lib/types/thread-types';
import { values } from 'lib/utils/objects';
@@ -27,6 +29,7 @@
import { createThread } from '../creators/thread-creator';
import { deleteThread } from '../deleters/thread-deleters';
+import { fetchMediaForThread } from '../fetchers/upload-fetchers';
import type { Viewer } from '../session/viewer';
import {
updateRole,
@@ -176,6 +179,18 @@
return await joinThread(viewer, request);
}
+const threadFetchMediaRequestInputValidator = tShape({
+ threadID: t.String,
+});
+async function threadFetchMediaResponder(
+ viewer: Viewer,
+ input: any,
+): Promise<$ReadOnlyArray<Media>> {
+ const request: ThreadFetchMediaRequest = input;
+ await validateInput(viewer, threadFetchMediaRequestInputValidator, request);
+ return await fetchMediaForThread(request.threadID);
+}
+
export {
threadDeletionResponder,
roleUpdateResponder,
@@ -184,5 +199,6 @@
threadUpdateResponder,
threadCreationResponder,
threadJoinResponder,
+ threadFetchMediaResponder,
newThreadRequestInputValidator,
};
diff --git a/lib/actions/thread-actions.js b/lib/actions/thread-actions.js
--- a/lib/actions/thread-actions.js
+++ b/lib/actions/thread-actions.js
@@ -2,6 +2,7 @@
import invariant from 'invariant';
+import type { Media } from '../types/media-types';
import type {
ChangeThreadSettingsPayload,
LeaveThreadPayload,
@@ -162,6 +163,13 @@
};
};
+const fetchThreadMedia = (
+ callServerEndpoint: CallServerEndpoint,
+): ((threadID: string) => Promise<$ReadOnlyArray<Media>>) => async threadID => {
+ const response = await callServerEndpoint('fetch_thread_media', { threadID });
+ return response;
+};
+
export {
deleteThreadActionTypes,
deleteThread,
@@ -177,4 +185,5 @@
joinThread,
leaveThreadActionTypes,
leaveThread,
+ fetchThreadMedia,
};
diff --git a/lib/types/endpoints.js b/lib/types/endpoints.js
--- a/lib/types/endpoints.js
+++ b/lib/types/endpoints.js
@@ -61,6 +61,7 @@
FETCH_ENTRY_REVISIONS: 'fetch_entry_revisions',
FETCH_ERROR_REPORT_INFOS: 'fetch_error_report_infos',
FETCH_MESSAGES: 'fetch_messages',
+ FETCH_THREAD_MEDIA: 'fetch_thread_media',
GET_SESSION_PUBLIC_KEYS: 'get_session_public_keys',
JOIN_THREAD: 'join_thread',
LEAVE_THREAD: 'leave_thread',
diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js
--- a/lib/types/thread-types.js
+++ b/lib/types/thread-types.js
@@ -434,6 +434,10 @@
+userInfos: $ReadOnlyArray<UserInfo>,
};
+export type ThreadFetchMediaRequest = {
+ +threadID: string,
+};
+
export type SidebarInfo = {
+threadInfo: ThreadInfo,
+lastUpdatedTime: number,

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 7, 6:05 AM (7 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5842748
Default Alt Text
D6531.1765087549.diff (3 KB)

Event Timeline