Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32090958
D15501.1765008408.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D15501.1765008408.diff
View Options
diff --git a/lib/shared/farcaster/farcaster-api.js b/lib/shared/farcaster/farcaster-api.js
--- a/lib/shared/farcaster/farcaster-api.js
+++ b/lib/shared/farcaster/farcaster-api.js
@@ -928,6 +928,7 @@
export type PinMessageInput = {
+conversationId: string,
+messageId: string,
+ +action: 'pin' | 'unpin',
};
function usePinMessage(): (input: PinMessageInput) => Promise<void> {
@@ -935,19 +936,23 @@
const { addLog } = useDebugLogs();
return React.useCallback(
async (input: PinMessageInput) => {
+ const { conversationId, messageId, action } = input;
+ const method = action === 'pin' ? { type: 'POST' } : { type: 'DELETE' };
+
try {
await sendFarcasterRequest({
apiVersion: 'v2',
endpoint: 'direct-cast-pin-message',
- method: { type: 'POST' },
- payload: JSON.stringify(input),
+ method,
+ payload: JSON.stringify({ conversationId, messageId }),
});
} catch (error) {
addLog(
- 'Farcaster API: Failed to pin a message',
+ `Farcaster API: Failed to ${action} a message`,
JSON.stringify({
- conversationId: input.conversationId,
- messageId: input.messageId,
+ conversationId,
+ messageId,
+ action,
error: getMessageForException(error),
}),
new Set([logTypes.FARCASTER, logTypes.ERROR]),
diff --git a/lib/shared/threads/protocols/farcaster-thread-protocol.js b/lib/shared/threads/protocols/farcaster-thread-protocol.js
--- a/lib/shared/threads/protocols/farcaster-thread-protocol.js
+++ b/lib/shared/threads/protocols/farcaster-thread-protocol.js
@@ -954,7 +954,7 @@
input: ProtocolPinMessageInput,
utils: PinMessageUtils,
): Promise<void> => {
- const { messageID, threadInfo } = input;
+ const { messageID, threadInfo, action } = input;
const { farcasterPinMessage } = utils;
const conversationId = conversationIDFromFarcasterThreadID(threadInfo.id);
@@ -962,6 +962,7 @@
await farcasterPinMessage({
conversationId,
messageId: messageID,
+ action,
});
},
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 8:06 AM (22 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5834248
Default Alt Text
D15501.1765008408.diff (2 KB)
Attached To
Mode
D15501: [lib] Handle unpinning a message
Attached
Detach File
Event Timeline
Log In to Comment