Merge pull request #404 from gitroomhq/bugfix-bluesky-links-and-tags

bugfix: #394 Bluesky posts now support "richtext" (URLs, tags, etc)
This commit is contained in:
James Read 2024-10-28 23:36:08 +00:00 committed by GitHub
commit 8fb0729740
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -6,7 +6,7 @@ import {
} from '@gitroom/nestjs-libraries/integrations/social/social.integrations.interface';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';
import { SocialAbstract } from '@gitroom/nestjs-libraries/integrations/social.abstract';
import { BskyAgent } from '@atproto/api';
import { BskyAgent, RichText } from '@atproto/api';
import dayjs from 'dayjs';
import { Integration } from '@prisma/client';
import { AuthService } from '@gitroom/helpers/auth/auth.service';
@ -132,9 +132,16 @@ export class BlueskyProvider extends SocialAbstract implements SocialProvider {
}) || []
);
const rt = new RichText({
text: post.message,
})
await rt.detectFacets(agent)
// @ts-ignore
const { cid, uri, commit } = await agent.post({
text: post.message,
text: rt.text,
facets: rt.facets,
createdAt: new Date().toISOString(),
...(images.length
? {