autogestion / pubgate-philip

Minimalist blogging ActivityPub client made with Svelte
10 stars 2 forks source link

Implement mentions #27

Open autogestion opened 4 years ago

autogestion commented 4 years ago

Mentioning user should work in same way as hashtags works

  1. detect mentions in text in same way as for hashtags https://github.com/autogestion/pubgate-philip/blob/master/philip/src/components/Publish.svelte#L11 mention format is @username@domain

  2. wrap it in html, same as mastodon does (so it will be displayed at mastodon servers correctly html format is <span ' 'class="h-card"><a' 'href="<user_id>" ' 'class="u-url mention">@<span>username</span></a></span></p>' to get user_id, it should be fetched from mentioned user server, by using FollowYourNose principle ( https://domain/@username) or by using webfinger (to be compatible with pleroma, as described in #26 )

  3. Create mention sub-object, same as for hashtag https://github.com/autogestion/pubgate-philip/blob/master/philip/src/components/Publish.svelte#L27 sub-object format {'href': '<user_id>', 'name': '@username@domain', 'type': 'Mention'}

  4. Add to Create object cc attribute, same as when making a comment 'cc': [user_id]

Final output, sent to outbox, should be { "type": "Create", "cc": [<user_id>] "object": { "type": "Note", "content": "<span ' 'class="h-card"><a' 'href="<user_id>" ' 'class="u-url mention">@<span>username</span></a></span></p>", "tag": [ { "type": "Mention", "href": "<user_id>", "name": "@username@domain" }, ] } }

`

autogestion commented 4 years ago

Implement mentions for Pleroma users, which do no have FollowYourNose ids and their id url have to be autodiscovered via webfinger