Page MenuHomePhorge

D15533.1765007859.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D15533.1765007859.diff

diff --git a/lib/hooks/thread-hooks.js b/lib/hooks/thread-hooks.js
--- a/lib/hooks/thread-hooks.js
+++ b/lib/hooks/thread-hooks.js
@@ -18,6 +18,7 @@
import { useProcessAndSendDMOperation } from '../shared/dm-ops/process-dm-ops.js';
import {
useUpdateFarcasterGroupNameAndDescription,
+ useUpdateFarcasterThreadAvatar,
useModifyFarcasterMembershipInput,
useAcceptInvite,
useAcceptOneOnOneInvite,
@@ -242,6 +243,7 @@
const keyserverCall = useKeyserverCall(changeThreadSettings);
const updateFarcasterGroupNameAndDescription =
useUpdateFarcasterGroupNameAndDescription();
+ const updateFarcasterThreadAvatar = useUpdateFarcasterThreadAvatar();
const modifyFarcasterMembership = useModifyFarcasterMembershipInput();
const refreshFarcasterConversation = useRefreshFarcasterConversation();
const auxUserStore = useSelector(state => state.auxUserStore);
@@ -254,6 +256,7 @@
processAndSendDMOperation,
keyserverChangeThreadSettings: keyserverCall,
updateFarcasterGroupNameAndDescription,
+ updateFarcasterThreadAvatar,
modifyFarcasterMembership,
refreshFarcasterConversation,
auxUserStore,
@@ -266,6 +269,7 @@
processAndSendDMOperation,
refreshFarcasterConversation,
updateFarcasterGroupNameAndDescription,
+ updateFarcasterThreadAvatar,
viewerID,
],
);
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
@@ -311,13 +311,13 @@
"Farcaster protocol doesn't support changing parent thread type",
);
- const conversationId = conversationIDFromFarcasterThreadID(threadInfo.id);
+ const conversationID = conversationIDFromFarcasterThreadID(threadInfo.id);
const promises = [];
if (changes.name || changes.description) {
promises.push(
updateFarcasterGroupNameAndDescription({
- conversationId,
+ conversationId: conversationID,
// Name is mandatory in the API, because of that input contains
// the updated name or the previous one.
name: changes.name ?? threadInfo.name ?? '',
@@ -338,7 +338,7 @@
if (targetFIDs.length > 0) {
const modifyFarcasterMembershipInput: ModifyFarcasterMembershipInput = {
- conversationId,
+ conversationId: conversationID,
action: 'add',
targetFids: targetFIDs,
};
@@ -348,14 +348,27 @@
);
}
}
- if (changes.avatar) {
- throw new Error('avatar not implemented yet');
+
+ if (changes.avatar && changes.avatar.type === 'non_keyserver_image') {
+ promises.push(
+ utils.updateFarcasterThreadAvatar({
+ conversationID,
+ action: { type: 'set', imageURL: changes.avatar.blobURI },
+ }),
+ );
+ } else if (changes.avatar && changes.avatar.type === 'remove') {
+ promises.push(
+ utils.updateFarcasterThreadAvatar({
+ conversationID,
+ action: { type: 'remove' },
+ }),
+ );
}
// Perform all updates before refreshing conversation
await Promise.all(promises);
- await refreshFarcasterConversation(conversationId);
+ await refreshFarcasterConversation(conversationID);
return ({
threadID: threadInfo.id,
diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js
--- a/lib/shared/threads/thread-spec.js
+++ b/lib/shared/threads/thread-spec.js
@@ -98,6 +98,7 @@
SendFarcasterMessageResult,
SendFarcasterTextMessageInput,
UpdateFarcasterGroupNameAndDescriptionInput,
+ UpdateFarcasterThreadAvatarInput,
UpdateFarcasterSubscriptionInput,
StreamFarcasterDirectCastReadInput,
MarkFarcasterDirectCastUnreadInput,
@@ -191,6 +192,7 @@
+processAndSendDMOperation: OutboundDMOperationSpecification => Promise<void>,
+keyserverChangeThreadSettings: UpdateThreadRequest => Promise<ChangeThreadSettingsPayload>,
+updateFarcasterGroupNameAndDescription: UpdateFarcasterGroupNameAndDescriptionInput => Promise<void>,
+ +updateFarcasterThreadAvatar: UpdateFarcasterThreadAvatarInput => Promise<void>,
+modifyFarcasterMembership: (
input: ModifyFarcasterMembershipInput,
) => Promise<void>,

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 6, 7:57 AM (22 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5834143
Default Alt Text
D15533.1765007859.diff (4 KB)

Event Timeline