feat: Add collections field to Notes

This commit is contained in:
Jesse Wierzbinski 2024-11-03 12:43:27 +01:00
parent b59b6b8ebb
commit e97b86f983
No known key found for this signature in database
9 changed files with 95 additions and 38 deletions

View file

@ -24,6 +24,8 @@ This page lists changes since Working Draft 3. {{ className: 'lead' }}
- Added [Interaction Controls Extensions](/extensions/interaction-controls)
- Added [URI Collections](/structures/collection#uri-collection)
- Changed all Collections that can contain remote entities to use URI Collections (eg. [User](/entities/user) `collections.followers`).
- Add `collections` field to [Notes](/entities/note).
- [Likes Extension](/extensions/likes), [Reactions Extension](/extensions/reactions) and [Share Extension](/extensions/share) now use this field, instead of a custom field in `extensions`.
## Since WD 3

View file

@ -36,6 +36,28 @@ Notes represent a piece of content on a Versia instance. They can be posted by [
| "messaging"; // Like Discord, Element (Matrix), Signal
```
</Property>
<Property name="collections" type="NoteCollections" required={true}>
Collections related to the note. Must contain at least `replies` and `quotes`.
```typescript
type URI = string;
type NoteCollections = {
replies: URI;
quotes: URI;
// Same format as type on Extensions
[key: ExtensionsKey]: URI;
}
```
All URIs must resolve to either a [Collection](/structures/collection) or a [URI Collection](/structures/collection#uri-collection) of the appropriate entities. Extensions may add additional collections.
### Replies
All replies to this note (have this note as their `replies_to`). [URI Collection](/structures/collection#uri-collection) of [Note](/entities/note) entities.
### Quotes
All quotes of this note (have this note as their `quotes`). [URI Collection](/structures/collection#uri-collection) of [Note](/entities/note) entities.
</Property>
<Property name="content" type="ContentFormat" required={false} typeLink="/structures/content-format">
The content of the note. Must be text format (`text/html`, `text/markdown`, etc). Must not be remote.
</Property>
@ -126,6 +148,13 @@ Notes represent a piece of content on a Versia instance. They can be posted by [
],
"author": "https://versia.social/users/018eb863-753f-76ff-83d6-fd590de7740a",
"category": "microblog",
"collections": {
"replies": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/replies",
"quotes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/quotes",
"pub.versia:likes/Likes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/likes",
"pub.versia:likes/Dislikes": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/dislikes",
"pub.versia:reactions/Reactions": "https://versia.social/objects/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/reactions"
},
"content": {
"text/html": {
"content": "<p>In the next versia-fe update: account settings, finally!</p>"

View file

@ -87,6 +87,10 @@ Custom Emojis can be added to any entity with text content. The extension ID is
"type": "Note",
"uri": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd",
"created_at": "2024-04-09T01:38:51.743Z",
"collections": {
"replies": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd/replies",
"quotes": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd/quotes"
},
"content": {
"text/plain": {
"content": "Hello, world :happy_face:!"

View file

@ -17,6 +17,10 @@ The entity defined in this document must be inserted in the `pub.versia:interact
"type": "Note",
"uri": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd",
"created_at": "2024-04-09T01:38:51.743Z",
"collections": {
"replies": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd/replies",
"quotes": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd/quotes"
},
"content": {
"text/plain": {
"content": "Hello, world :happy_face:!"

View file

@ -107,6 +107,25 @@ The Likes extension adds the following collections to the [User](/entities/user)
}
```
## Note Collections
The Likes extension adds the following collections to the [Note](/entities/note) entity:
- `likes`: A [URI Collection](/structures/collection#uri-collection) of all the likes the note has received.
- `dislikes`: A [URI Collection](/structures/collection#uri-collection) of all the dislikes the note has received.
```jsonc
{
"type": "Note",
...
"collections": {
...
"pub.versia:likes/Likes": "https://example.com/notes/fmKZ763jzIU8/likes",
"pub.versia:likes/Dislikes": "https://example.com/notes/fmKZ763jzIU8/dislikes"
}
}
```
## Interaction Types
<Note>

View file

@ -45,6 +45,10 @@ Note that there is no `question` field: the question should be included in the `
"created_at": "2024-06-19T01:07:44.139Z",
"author": "https://versia.social/users/018eb863-753f-76ff-83d6-fd590de7740a",
"category": "microblog",
"collections": {
"replies": "https://versia.social/notes/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/replies",
"quotes": "https://versia.social/notes/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/quotes"
},
"content": {
"text/plain": {
"content": "What is your favourite color?"

View file

@ -50,48 +50,22 @@ User reactions are (like every other entity) federated to all followers, and can
</Col>
</Row>
## Extensions to Note
## Note Collections
The Reactions Extension extends the [Note](/entities/note) entity with the following fields:
The Likes extension adds the following collections to the [Note](/entities/note) entity:
<Row>
<Col>
<Properties>
<Property name="reactions" type="array" required>
URI to a [URI Collection](/structures/collection#uri-collection) of the [Reactions](#entity-definition) attached to the note.
</Property>
</Properties>
</Col>
- `reactions`: A [URI Collection](/structures/collection#uri-collection) of all the reactions to the note.
<Col sticky>
```jsonc {{ title: "Example Note" }}
{
"id": "01902e09-0f8b-72de-8ee3-9afc0cf5eae1",
"type": "Note", // [!code focus]
"uri": "https://versia.social/notes/01902e09-0f8b-72de-8ee3-9afc0cf5eae1",
"created_at": "2024-06-19T01:07:44.139Z",
"author": "https://versia.social/users/018eb863-753f-76ff-83d6-fd590de7740a",
"category": "microblog",
"content": {
"text/plain": {
"content": "Bababooey."
```jsonc
{
"type": "Note",
...
"collections": {
...
"pub.versia:reactions/Reactions": "https://example.com/publications/f08a124e-fe90-439e-8be4-15a428a72a19/reactions"
}
},
"extensions": { // [!code focus:5]
"pub.versia:reactions": {
"reactions": "https://versia.social/notes/01902e09-0f8b-72de-8ee3-9afc0cf5eae1/reactions"
}
},
"group": "public",
"is_sensitive": false,
"mentions": [],
}
```
</Col>
</Row>
}
```
## Interaction Types

View file

@ -46,6 +46,23 @@ When a user shares a note, the note's original author **must** receive the entit
</Col>
</Row>
## Note Collections
The Share extension adds the following collections to the [Note](/entities/note) entity:
- `shares`: A [URI Collection](/structures/collection#uri-collection) of all the shares of the note.
```jsonc
{
"type": "Note",
...
"collections": {
...
"pub.versia:share/Shares": "https://example.com/notes/fmKZ763jzIU8/shares"
}
}
```
## Interaction Types
<Note>

View file

@ -65,6 +65,10 @@ Pages should be limited to a reasonable number of entities, such as 20 or 80.
"type": "Note",
"uri": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd",
"created_at": "2024-04-09T01:38:51.743Z",
"collections": {
"replies": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd/replies",
"quotes": "https://versia.social/notes/456df8ed-daf1-4062-abab-491071c7b8dd/quotes"
},
"content": {
"text/plain": {
"content": "Hello, world!"