activitypub: remove akkoma quote URLs #245

Merged
norm merged 1 commit from html-quote into main 2022-11-20 20:48:16 +00:00
Owner

This should correctly display AP objects like this:

{
    "@context": [
        "https://www.w3.org/ns/activitystreams",
        "https://fedi.absturztau.be/schemas/litepub-0.1.jsonld",
        {
            "@language": "und"
        }
    ],
    "actor": "https://fedi.absturztau.be/users/enigmatico",
    "attachment": [],
    "attributedTo": "https://fedi.absturztau.be/users/enigmatico",
    "cc": [
        "https://fedi.absturztau.be/users/enigmatico/followers"
    ],
    "content": "Classic fedi friday<span class=\"quote-inline\"><br/><br/>RE: <a href=\"https://mk.absturztau.be/notes/97qk2ozlsj\">https://mk.absturztau.be/notes/97qk2ozlsj</a></span>",
    "context": "https://fedi.absturztau.be/contexts/197cea94-d818-457b-b4b4-d0239725c448",
    "conversation": "https://fedi.absturztau.be/contexts/197cea94-d818-457b-b4b4-d0239725c448",
    "id": "https://fedi.absturztau.be/objects/3444d3a3-53ac-496a-bb9c-b9c0bd14ea6c",
    "published": "2022-11-18T21:32:15.127195Z",
    "quoteUri": "https://mk.absturztau.be/notes/97qk2ozlsj",
    "quoteUrl": "https://mk.absturztau.be/notes/97qk2ozlsj",
    "repliesCount": 1,
    "sensitive": null,
    "source": {
        "content": "Classic fedi friday",
        "mediaType": "text/plain"
    },
    "summary": "",
    "tag": [],
    "to": [
        "https://www.w3.org/ns/activitystreams#Public"
    ],
    "type": "Note"
}
This should correctly display AP objects like this: ```json { "@context": [ "https://www.w3.org/ns/activitystreams", "https://fedi.absturztau.be/schemas/litepub-0.1.jsonld", { "@language": "und" } ], "actor": "https://fedi.absturztau.be/users/enigmatico", "attachment": [], "attributedTo": "https://fedi.absturztau.be/users/enigmatico", "cc": [ "https://fedi.absturztau.be/users/enigmatico/followers" ], "content": "Classic fedi friday<span class=\"quote-inline\"><br/><br/>RE: <a href=\"https://mk.absturztau.be/notes/97qk2ozlsj\">https://mk.absturztau.be/notes/97qk2ozlsj</a></span>", "context": "https://fedi.absturztau.be/contexts/197cea94-d818-457b-b4b4-d0239725c448", "conversation": "https://fedi.absturztau.be/contexts/197cea94-d818-457b-b4b4-d0239725c448", "id": "https://fedi.absturztau.be/objects/3444d3a3-53ac-496a-bb9c-b9c0bd14ea6c", "published": "2022-11-18T21:32:15.127195Z", "quoteUri": "https://mk.absturztau.be/notes/97qk2ozlsj", "quoteUrl": "https://mk.absturztau.be/notes/97qk2ozlsj", "repliesCount": 1, "sensitive": null, "source": { "content": "Classic fedi friday", "mediaType": "text/plain" }, "summary": "", "tag": [], "to": [ "https://www.w3.org/ns/activitystreams#Public" ], "type": "Note" } ```
norm reviewed 2022-11-20 05:30:32 +00:00
@ -8,3 +8,3 @@
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
export function fromHtml(html: string, hashtagNames?: string[]): string {
export function fromHtml(html: string, hashtagNames?: string[], quoteUri?: string | null | undefined): string {
Owner

Since quoteUri is already marked as optional, you don't need to explicitly mark it as maybe undefined.

Since `quoteUri` is already marked as optional, you don't need to explicitly mark it as maybe `undefined`.
Author
Owner

I just remember that I saw stuff like that elsewhere in the backend so I assumed it has to be given separately. But looking it up it seems it is indeed unnecessary.

I just remember that I saw stuff like that elsewhere in the backend so I assumed it has to be given separately. But looking it up it seems it is indeed unnecessary.
Johann150 marked this conversation as resolved
norm reviewed 2022-11-20 05:30:53 +00:00
@ -3,3 +3,3 @@
import { fromHtml } from '@/mfm/from-html.js';
export function htmlToMfm(html: string, tag?: IObject | IObject[]) {
export function htmlToMfm(html: string, tag?: IObject | IObject[], quoteUri?: string | null | undefined) {
Owner

Don't need the explicit undefined here as well.

Don't need the explicit `undefined` here as well.
Johann150 marked this conversation as resolved
Johann150 force-pushed html-quote from df185aa87a to 4a7caffbe1 2022-11-20 08:53:35 +00:00 Compare
norm approved these changes 2022-11-20 16:30:07 +00:00
norm merged commit 66a7c62342 into main 2022-11-20 20:48:16 +00:00
norm deleted branch html-quote 2022-11-20 20:48:16 +00:00
Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
2 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#245
No description provided.