Include/copy context in Note activities #53

Open
opened 2022-08-02 08:45:50 +00:00 by floatingghost · 7 comments

so this is part of the source of a lot of thread-breaky weirdness between the *keys and others

basically, the context key is not included on notes from *key, which makes resolving which thread they're a part of quite difficult

context is essentially an opaque string (by mastodon convention, a URL https://example.com/contexts/<id>) which is created by the original post in a thread and simply copied in subsequent replies - nothing need be served at that URL

this alone would go a long way to fixing weird federation stuffs

examples of notes with context attached

generation of context ID *roma-side: https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/common_api/utils.ex#L230

so this is part of the source of a lot of thread-breaky weirdness between the \*keys and others basically, the `context` key is not included on notes from \*key, which makes resolving which thread they're a part of quite difficult `context` is essentially an opaque string (by mastodon convention, a URL `https://example.com/contexts/<id>`) which is created by the original post in a thread and simply copied in subsequent replies - nothing need be served at that URL this alone would go a long way to fixing weird federation stuffs examples of notes with context attached generation of context ID \*roma-side: https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/web/common_api/utils.ex#L230
Owner

We already have a threadId in the database which is just the id of the initial note in that thread. But if you say opaque string I guess we could just as well put the URL of that note in there?

We already have a `threadId` in the database which is just the id of the initial note in that thread. But if you say opaque string I guess we could just as well put the URL of that note in there?
Author

yeah that would actually work i think

yeah that would actually work i think
Author

(oh, and then copy on reply, so if you get context=abc in and reply to it, it should spit out context=abc again)

(oh, and then copy on reply, so if you get context=abc in and reply to it, it should spit out context=abc again)
Johann150 added reference context 2022-08-03 08:59:35 +00:00
Johann150 added this to the (deleted) project 2022-08-03 08:59:49 +00:00
Owner

Looked at it quickly re: the copying bit.
Looks like to support copying we'll need to handle receiving federation to override the threadId to whatever the remote end's context is (if present, else default to current behavior).
I'm not sure where the "incoming" federation bits are yet, though.
But after that (+ the commit Johann already made) we should be compliant?

Copying the threadId from the context should work because threadId also appears to just be an opaque string (varchar 256 in particular).
At least on the backend, it's only really used for muting threads, so yeah.

My guess is backend's src/remote/activitypub/models/note.ts which calls into src/services/note/create.ts - is that right @Johann150 ?

Looked at it quickly re: the copying bit. Looks like to support copying we'll need to handle receiving federation to override the threadId to whatever the remote end's context is (if present, else default to current behavior). I'm not sure where the "incoming" federation bits are yet, though. But after that (+ the commit Johann already made) we should be compliant? Copying the threadId from the context should work because threadId also appears to just be an opaque string (varchar 256 in particular). At least on the backend, it's only really used for muting threads, so yeah. My guess is backend's `src/remote/activitypub/models/note.ts` which calls into `src/services/note/create.ts` - is that right @Johann150 ?
Owner

To write this down since I looked it up now:

context is essentially an opaque string (by mastodon convention, a URL https://example.com/contexts/<id>)

It is not completely an opaque string.

The ActivityStreams vocabulary specification for the context field says Range: Object | Link, i.e. it should be an ActivityStreams object or a link to one. Or of course - by virtue of JSON-LD - it can be just a URL which would be the ID of said object.

Since the URL is just used as an ID, as far as I remember that still does not mean anything has to be served there.

To write this down since I looked it up now: > `context` is essentially an opaque string (by mastodon convention, a URL `https://example.com/contexts/<id>`) It is not completely an opaque string. The [ActivityStreams vocabulary specification for the `context` field](https://www.w3.org/TR/2017/REC-activitystreams-vocabulary-20170523/#dfn-context) says `Range: Object | Link`, i.e. it should be an ActivityStreams object or a link to one. Or of course - by virtue of JSON-LD - it can be just a URL which would be the ID of said object. Since the URL is just used as an ID, as far as I remember that still does not mean anything has to be served there.
Owner

We could potentially have an API endpoint that serves a Collection back from the context/threadId and serve that.
Could be a good exercise for me to start figuring out typeorm and such.

We could potentially have an API endpoint that serves a Collection back from the context/threadId and serve that. Could be a good exercise for me to start figuring out typeorm and such.
Owner

Finally sat down and figured out how to do the migration. The threadId column now holds the context URL instead of just the ID.

My guess is backend's src/remote/activitypub/models/note.ts which calls into src/services/note/create.ts - is that right @Johann150 ?

Yes I believe that would be correct.

Finally sat down and figured out how to do the migration. The `threadId` column now holds the context URL instead of just the ID. > My guess is backend's `src/remote/activitypub/models/note.ts` which calls into `src/services/note/create.ts` - is that right @Johann150 ? Yes I believe that would be correct.
toast self-assigned this 2022-10-31 19:20:01 +00:00
Johann150 added the
feature
label 2022-12-23 10:14:11 +00:00
Johann150 removed this from the (deleted) project 2022-12-23 10:14:13 +00:00
Sign in to join this conversation.
No Label
feature
fix
upkeep
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#53
No description provided.