Skip to content

Commit

Permalink
bluesky.to_as1: app.bsky.actor.profile: add HTML links to URLs in sum…
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed May 22, 2024
1 parent 1e85054 commit 4d190a2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ Changelog
* `com.atproto.repo.strongRef`
* Add hashtag facet support.
* Convert blobs in embeds to `getBlob` image URLs.
* `app.bsky.actor.profile`: add HTML links for URLs in `summary` ([snarfed/bridgy-fed#1065](https://github.com/snarfed/bridgy-fed/issues/1065)).
* `from_as1`:
* Add hashtag, mention, block, and flag support. Interpret `tags` with missing `objectType` as hashtags.
* Guess missing indices in facets based on content text. Otherwise, if we still don't know a facet's indices, discard it.
Expand Down
2 changes: 1 addition & 1 deletion granary/bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ def to_as1(obj, type=None, uri=None, repo_did=None, repo_handle=None,
'url': urls,
'displayName': obj.get('displayName'),
'username': obj.get('handle') or repo_handle,
'summary': obj.get('description'),
'summary': util.linkify(obj.get('description') or '', pretty=True),
'image': images,
'published': obj.get('createdAt'),
}
Expand Down
9 changes: 9 additions & 0 deletions granary/tests/test_bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,15 @@ def test_to_as1_profile(self):
'url': ['https://bsky.app/profile/han.dull', 'https://han.dull/'],
}, to_as1(ACTOR_PROFILE_BSKY, repo_did='did:plc:foo', repo_handle='han.dull'))

def test_to_as1_profile_links_in_bio(self):
self.assert_equals({
'objectType': 'person',
'summary': 'one <a href="http://li.nk/foo">li.nk/foo</a> two <a href="http://li.nk">li.nk</a> three <a href="https://www.li.nk/">li.nk</a>',
}, to_as1({
'$type': 'app.bsky.actor.profile',
'description': 'one http://li.nk/foo two li.nk three https://www.li.nk/',
}))

def test_to_as1_profile_bsky_social_handle_is_not_url(self):
self.assert_equals({
'objectType': 'person',
Expand Down

0 comments on commit 4d190a2

Please sign in to comment.