Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32133993
D15532.1765026738.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
D15532.1765026738.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
@@ -453,31 +453,47 @@
);
}
-export type UpdateFarcasterGroupPhotoInput = {
- +conversationId: string,
- +photoUrl: string,
+export type UpdateFarcasterThreadAvatarInput = {
+ +conversationID: string,
+ +action:
+ | {
+ +type: 'set',
+ +imageURL: string,
+ }
+ | {
+ +type: 'remove',
+ },
};
-function useUpdateFarcasterGroupPhoto(): (
- input: UpdateFarcasterGroupPhotoInput,
+function useUpdateFarcasterThreadAvatar(): (
+ input: UpdateFarcasterThreadAvatarInput,
) => Promise<void> {
const { sendFarcasterRequest } = useTunnelbroker();
const { addLog } = useDebugLogs();
return React.useCallback(
- async (input: UpdateFarcasterGroupPhotoInput) => {
+ async (input: UpdateFarcasterThreadAvatarInput) => {
+ const payload =
+ input.action.type === 'set'
+ ? {
+ conversationId: input.conversationID,
+ photoUrl: input.action.imageURL,
+ }
+ : {
+ conversationId: input.conversationID,
+ };
try {
await sendFarcasterRequest({
apiVersion: 'v2',
endpoint: 'direct-cast-group-photo',
method: { type: 'POST' },
- payload: JSON.stringify(input),
+ payload: JSON.stringify(payload),
});
} catch (error) {
addLog(
'Farcaster API: Failed to update group photo',
JSON.stringify({
- conversationId: input.conversationId,
- photoUrl: input.photoUrl,
+ conversationID: input.conversationID,
+ action: input.action,
error: getMessageForException(error),
}),
new Set([logTypes.FARCASTER, logTypes.ERROR]),
@@ -1007,7 +1023,7 @@
useFetchFarcasterConversation,
useFetchFarcasterInbox,
useUpdateFarcasterGroupNameAndDescription,
- useUpdateFarcasterGroupPhoto,
+ useUpdateFarcasterThreadAvatar,
useUpdateFarcasterSubscription,
useStreamFarcasterDirectCastRead,
useMarkFarcasterDirectCastUnread,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 1:12 PM (17 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5837873
Default Alt Text
D15532.1765026738.diff (2 KB)
Attached To
Mode
D15532: [lib] Add an option to remove avatar to the API
Attached
Detach File
Event Timeline
Log In to Comment