Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32162488
D15325.1765045024.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D15325.1765045024.diff
View Options
diff --git a/lib/utils/convert-farcaster-message-to-comm-messages.js b/lib/utils/convert-farcaster-message-to-comm-messages.js
--- a/lib/utils/convert-farcaster-message-to-comm-messages.js
+++ b/lib/utils/convert-farcaster-message-to-comm-messages.js
@@ -7,7 +7,7 @@
farcasterThreadIDFromConversationID,
userIDFromFID,
} from '../shared/id-utils.js';
-import type { Media } from '../types/media-types.js';
+import type { Image } from '../types/media-types.js';
import { messageTypes } from '../types/message-types-enum.js';
import type { RawMessageInfo } from '../types/message-types.js';
@@ -57,18 +57,37 @@
height: med.height,
width: med.width,
},
- }: Media),
+ }: Image),
);
- return [
+
+ const time = parseInt(farcasterMessage.serverTimestamp, 10);
+ const messages: Array<RawMessageInfo> = [
{
id: farcasterMessage.messageId,
type: messageTypes.MULTIMEDIA,
threadID,
creatorID,
- time: parseInt(farcasterMessage.serverTimestamp, 10),
+ time,
media,
},
];
+
+ const captionText = media
+ .reduce((text, m) => text.replaceAll(m.uri, ''), farcasterMessage.message)
+ .trim();
+
+ if (captionText.length > 0) {
+ messages.push({
+ id: farcasterMessage.messageId + '/caption',
+ type: messageTypes.TEXT,
+ threadID,
+ creatorID,
+ time,
+ text: captionText,
+ });
+ }
+
+ return messages;
}
if (farcasterMessage.type === 'text') {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 6, 6:17 PM (13 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840063
Default Alt Text
D15325.1765045024.diff (1 KB)
Attached To
Mode
D15325: [lib] Support image captions in FC threads
Attached
Detach File
Event Timeline
Log In to Comment