Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3357801
D7112.id23908.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7112.id23908.diff
View Options
diff --git a/keyserver/src/endpoints.js b/keyserver/src/endpoints.js
--- a/keyserver/src/endpoints.js
+++ b/keyserver/src/endpoints.js
@@ -25,6 +25,7 @@
messageFetchResponder,
multimediaMessageCreationResponder,
reactionMessageCreationResponder,
+ fetchPinnedMessagesResponder,
} from './responders/message-responders.js';
import { updateRelationshipsResponder } from './responders/relationship-responders.js';
import {
@@ -136,6 +137,10 @@
responder: messageFetchResponder,
requiredPolicies: baseLegalPolicies,
},
+ fetch_pinned_messages: {
+ responder: fetchPinnedMessagesResponder,
+ requiredPolicies: baseLegalPolicies,
+ },
fetch_thread_media: {
responder: threadFetchMediaResponder,
requiredPolicies: baseLegalPolicies,
diff --git a/keyserver/src/responders/message-responders.js b/keyserver/src/responders/message-responders.js
--- a/keyserver/src/responders/message-responders.js
+++ b/keyserver/src/responders/message-responders.js
@@ -19,6 +19,8 @@
type FetchMessageInfosRequest,
defaultNumberPerThread,
type SendMessageResponse,
+ type FetchPinnedMessagesRequest,
+ type FetchPinnedMessagesResult,
} from 'lib/types/message-types.js';
import type { ReactionMessageData } from 'lib/types/messages/reaction.js';
import type { TextMessageData } from 'lib/types/messages/text.js';
@@ -37,6 +39,7 @@
fetchMessageInfoForLocalID,
fetchMessageInfoByID,
fetchThreadMessagesCount,
+ fetchPinnedMessageInfos,
} from '../fetchers/message-fetchers.js';
import { fetchServerThreadInfos } from '../fetchers/thread-fetchers.js';
import { checkThreadPermission } from '../fetchers/thread-permission-fetchers.js';
@@ -286,9 +289,26 @@
return { newMessageInfo: rawMessageInfos[0] };
}
+const fetchPinnedMessagesResponderInputValidator = tShape({
+ threadID: t.String,
+});
+async function fetchPinnedMessagesResponder(
+ viewer: Viewer,
+ input: any,
+): Promise<?FetchPinnedMessagesResult> {
+ const request: FetchPinnedMessagesRequest = input;
+ await validateInput(
+ viewer,
+ fetchPinnedMessagesResponderInputValidator,
+ input,
+ );
+ return await fetchPinnedMessageInfos(viewer, request);
+}
+
export {
textMessageCreationResponder,
messageFetchResponder,
multimediaMessageCreationResponder,
reactionMessageCreationResponder,
+ fetchPinnedMessagesResponder,
};
diff --git a/lib/actions/message-actions.js b/lib/actions/message-actions.js
--- a/lib/actions/message-actions.js
+++ b/lib/actions/message-actions.js
@@ -7,6 +7,8 @@
SendMessageResult,
SendReactionMessageRequest,
SimpleMessagesPayload,
+ FetchPinnedMessagesRequest,
+ FetchPinnedMessagesResult,
} from '../types/message-types.js';
import type { MediaMessageServerDBContent } from '../types/messages/media.js';
import type {
@@ -243,6 +245,17 @@
const processMessagesActionType = 'PROCESS_MESSAGES';
const messageStorePruneActionType = 'MESSAGE_STORE_PRUNE';
+const fetchPinnedMessages =
+ (
+ callServerEndpoint: CallServerEndpoint,
+ ): ((
+ request: FetchPinnedMessagesRequest,
+ ) => Promise<?FetchPinnedMessagesResult>) =>
+ async request => {
+ const response = await callServerEndpoint('fetch_pinned_messages', request);
+ return { pinnedMessages: response.pinnedMessages };
+ };
+
export {
fetchMessagesBeforeCursorActionTypes,
fetchMessagesBeforeCursor,
@@ -261,4 +274,5 @@
saveMessagesActionType,
processMessagesActionType,
messageStorePruneActionType,
+ fetchPinnedMessages,
};
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_PINNED_MESSAGES: 'fetch_pinned_messages',
FETCH_THREAD_MEDIA: 'fetch_thread_media',
GET_SESSION_PUBLIC_KEYS: 'get_session_public_keys',
JOIN_THREAD: 'join_thread',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 1:40 AM (21 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577948
Default Alt Text
D7112.id23908.diff (3 KB)
Attached To
Mode
D7112: [keyserver/lib] Set up responders, endpoints, and related functions to fetch all pinned messages
Attached
Detach File
Event Timeline
Log In to Comment