-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bluesky.from_as1: mention facet bug fix for mentions at beginning of …
…content fixes snarfed/bridgy-fed#957 (again)
- Loading branch information
Showing
2 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -863,8 +863,36 @@ def test_from_as1_tag_mention_at_char_html_content_guess_index(self): | |
note = copy.deepcopy(NOTE_AS_TAG_MENTION_URL) | ||
note['content'] = '<p>foo <a href="https://bsky.app/...">@you.com</a> bar</p>' | ||
note['tags'][0]['displayName'] = '@you.com' | ||
del note['tags'][0]['startIndex'] | ||
del note['tags'][0]['length'] | ||
self.assert_equals(POST_BSKY_FACET_MENTION, from_as1(note)) | ||
|
||
def test_from_as1_tag_mention_at_beginning(self): | ||
self.assert_equals({ | ||
'$type': 'app.bsky.feed.post', | ||
'createdAt': '2022-01-02T03:04:05.000Z', | ||
'text': '@shreyanjain.net hello there', | ||
'facets': [{ | ||
'$type': 'app.bsky.richtext.facet', | ||
'features': [{ | ||
'$type': 'app.bsky.richtext.facet#mention', | ||
'did': 'did:plc:foo', | ||
}], | ||
'index': { | ||
'byteStart': 0, | ||
'byteEnd': 16, | ||
}, | ||
}], | ||
}, from_as1({ | ||
'objectType' : 'note', | ||
'content' : '<p><span class=\'h-card\' translate=\'no\'><a href=\'https://bsky.brid.gy/r/https://bsky.app/profile/shreyanjain.net\' class=\'u-url mention\'>@<span>shreyanjain.net</span></a></span> hello there</p>', | ||
'tags' : [{ | ||
'objectType': 'mention', | ||
'displayName': '@[email protected]', | ||
'url': 'did:plc:foo', | ||
}], | ||
})) | ||
|
||
def test_from_as1_tag_mention_not_bluesky(self): | ||
self.assert_equals({ | ||
'$type': 'app.bsky.feed.post', | ||
|