Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32179373
D15222.1765072934.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
D15222.1765072934.diff
View Options
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
@@ -13,14 +13,18 @@
type SendMultimediaMessagePayload,
} from '../../../types/message-types.js';
import type {
+ FarcasterRawThreadInfo,
MemberInfoSansPermissions,
RawThreadInfo,
+ RoleInfo,
+ ThreadCurrentUserInfo,
} from '../../../types/minimally-encoded-thread-permissions-types.js';
import type { SubscriptionUpdateResult } from '../../../types/subscription-types.js';
import type { ThreadType } from '../../../types/thread-types-enum.js';
import { assertFarcasterThreadType } from '../../../types/thread-types-enum.js';
import type {
ChangeThreadSettingsPayload,
+ ClientDBThreadInfo,
ThreadJoinPayload,
} from '../../../types/thread-types.js';
import { farcasterThreadIDRegExp } from '../../../utils/validation-utils.js';
@@ -82,8 +86,43 @@
throw new Error('leaveThread method is not yet implemented');
},
- convertClientDBThreadInfo: (): RawThreadInfo => {
- throw new Error('convertClientDBThreadInfo method is not yet implemented');
+ convertClientDBThreadInfo: (
+ clientDBThreadInfo: ClientDBThreadInfo,
+ members: $ReadOnlyArray<MemberInfoSansPermissions>,
+ roles: { +[id: string]: RoleInfo },
+ currentUser: ThreadCurrentUserInfo,
+ ) => {
+ const farcasterThreadType = assertFarcasterThreadType(
+ clientDBThreadInfo.type,
+ );
+
+ let rawThreadInfo: FarcasterRawThreadInfo = {
+ farcaster: true,
+ id: clientDBThreadInfo.id,
+ type: farcasterThreadType,
+ name: clientDBThreadInfo.name,
+ description: clientDBThreadInfo.description,
+ color: clientDBThreadInfo.color,
+ creationTime: Number(clientDBThreadInfo.creationTime),
+ parentThreadID: clientDBThreadInfo.parentThreadID,
+ containingThreadID: clientDBThreadInfo.containingThreadID,
+ community: clientDBThreadInfo.community,
+ members,
+ roles,
+ currentUser,
+ repliesCount: clientDBThreadInfo.repliesCount,
+ pinnedCount: clientDBThreadInfo.pinnedCount,
+ minimallyEncoded: true,
+ };
+
+ if (clientDBThreadInfo.avatar) {
+ rawThreadInfo = {
+ ...rawThreadInfo,
+ avatar: JSON.parse(clientDBThreadInfo.avatar),
+ };
+ }
+
+ return rawThreadInfo;
},
fetchMessages: async (): Promise<void> => {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 2:02 AM (2 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5842082
Default Alt Text
D15222.1765072934.diff (2 KB)
Attached To
Mode
D15222: [lib] Handle loading Farcaster threads from the DB
Attached
Detach File
Event Timeline
Log In to Comment