From 970673d01137fecb665a93f6658b616a8c8655ac Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Fri, 2 Aug 2024 16:10:27 +0200 Subject: [PATCH] refactor: :memo: Rework Patch --- app/entities/patches/page.mdx | 46 +++-------------------------------- app/federation/http/page.mdx | 4 --- 2 files changed, 4 insertions(+), 46 deletions(-) diff --git a/app/entities/patches/page.mdx b/app/entities/patches/page.mdx index 567096a..eb8fce0 100644 --- a/app/entities/patches/page.mdx +++ b/app/entities/patches/page.mdx @@ -5,28 +5,15 @@ export const metadata = { # Patches -Patches represent changes to `Note` entities. They can be used to edit notes after their creation, such as fixing typos or adding more content. Patches are applied to notes by the author or by a moderator. {{ className: 'lead' }} - -## Why Patches? - -The reason why patches are used instead of editing the note directly is to preserve the history of the note. This is important for transparency and accountability. By using patches, users can see the original content of the note and all changes made to it. - -This is less important for other entities, such as `User` profiles, as their content is more disposable than notes. - -## Structure - -`Patch`es are extensions of the `Note` entity, with the type set to `Patch` and extra attributes defined below. Note that each subsequent patch is applied to the original object, not the preceding patch. The server is responsible for presenting the most recent patch stored to the client. +Patches are entities that indicate a change to another entity. They are sent to instances as a kind of "reindex this entity" message. Patches are used to update entities that have already been distributed to other instances. ## Entity Definition - - ID of the note that was patched. The Patch's `id` property should be used to identify the patch itself. - - - Date and time when the patch was applied. + + URI of the entity that was patched. Must be an absolute URI on the same instance. @@ -37,32 +24,7 @@ This is less important for other entities, such as `User` profiles, as their con "type": "Patch", // [!code focus] "uri": "https://social.lysand.org/objects/be96bb7a-4b8e-45f9-93aa-23633eb3cfdc", "created_at": "2024-06-19T01:07:44.139Z", - "patched_id": "01902e09-0f8b-72de-8ee3-9afc0cf5eae1", // [!code focus:2] - "patched_at": "2024-06-19T01:07:44.139Z", - "author": "https://social.lysand.org/users/018eb863-753f-76ff-83d6-fd590de7740a", - "category": "microblog", - "content": { - "text/html": { - "content": "

No more attachments!

" - }, - "text/plain": { - "content": "No more attachments!" - } - }, - "device": { - "name": "Megalodon for Android", - "version": "1.3.89", - "url": "https://sk22.github.io/megalodon" - }, - "extensions": { - "org.lysand:custom_emojis": { - "emojis": [] - } - }, - "group": "public", - "is_sensitive": false, - "mentions": [], - "subject": "Lysand development" + "patched": "https://social.lysand.org/notes/9a8928b6-2526-4979-aab1-ef2f88cd5700", // [!code focus] } ``` diff --git a/app/federation/http/page.mdx b/app/federation/http/page.mdx index 75ba12b..43c291c 100644 --- a/app/federation/http/page.mdx +++ b/app/federation/http/page.mdx @@ -57,9 +57,6 @@ ALL kinds of HTTP requests/responses between instances **MUST** include a [Signa Date and time of the response. - - Must include `no-store` on entities that can be edited directly without a `Patch`, such as `Users`. - @@ -68,7 +65,6 @@ ALL kinds of HTTP requests/responses between instances **MUST** include a [Signa Content-Type: application/json; charset=utf-8 Date: Thu, 01 Jan 1970 00:00:00 GMT Signature: keyId="https://example.com/users/1",algorithm="ed25519",headers="(request-target) host date digest",signature="..." - Cache-Control: no-store ```
\ No newline at end of file