skymethod / minipub

Minimal ActivityPub implementation focused on commenting
https://minipub.dev
MIT License
58 stars 0 forks source link

v0.1.10 seems to be non-backwards compatible, summary is treated as mandatory #7

Closed dellagustin closed 1 year ago

dellagustin commented 1 year ago

Hello @johnspurlock-skymethod , I started testing v0.1.10. It is now failing to get comments for Activities without summary:

There was an error on the server fetching a comment Error: Expected 'summary' to be a string, found null
    at computeLanguageTaggedValues (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:1023:11)
    at computeSummary (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:1015:10)
    at computeComment (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:970:19)
    at Object.fetchActivityPubComment [as fetchComment] (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:839:10)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async processNode (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:1441:22)
    at async processLevel (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:1305:20)
    at async updateThreadcap (C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\node_modules\threadcap\cjs\main.js:1324:3)
    at async C:\Users\guilh\Desenvolvimento\podcastindex\web-ui\server\index.js:148:5**

Related to that, I found out that it is possible to have comments with empty content / contentMap, as long as it has an attachment. You might want to check if this is supported as well.

Example: https://fosstodon.org/@dellagustin/109794075204000680

{
    "@context": [
        "https://www.w3.org/ns/activitystreams",
        {
            "ostatus": "http://ostatus.org#",
            "atomUri": "ostatus:atomUri",
            "inReplyToAtomUri": "ostatus:inReplyToAtomUri",
            "conversation": "ostatus:conversation",
            "sensitive": "as:sensitive",
            "toot": "http://joinmastodon.org/ns#",
            "votersCount": "toot:votersCount",
            "blurhash": "toot:blurhash",
            "focalPoint": {
                "@container": "@list",
                "@id": "toot:focalPoint"
            }
        }
    ],
    "id": "https://fosstodon.org/users/dellagustin/statuses/109794075204000680",
    "type": "Note",
    "summary": null,
    "inReplyTo": "https://blob.cat/objects/5af09451-bccb-4a63-82fd-9a32316cff88",
    "published": "2023-02-02T07:57:13Z",
    "url": "https://fosstodon.org/@dellagustin/109794075204000680",
    "attributedTo": "https://fosstodon.org/users/dellagustin",
    "to": [
        "https://www.w3.org/ns/activitystreams#Public"
    ],
    "cc": [
        "https://fosstodon.org/users/dellagustin/followers"
    ],
    "sensitive": true,
    "atomUri": "https://fosstodon.org/users/dellagustin/statuses/109794075204000680",
    "inReplyToAtomUri": "https://blob.cat/objects/5af09451-bccb-4a63-82fd-9a32316cff88",
    "conversation": "tag:podcastindex.social,2023-01-13:objectId=4874906:objectType=Conversation",
    "content": "",
    "contentMap": {
        "en": ""
    },
    "attachment": [
        {
            "type": "Document",
            "mediaType": "image/jpeg",
            "url": "https://cdn.fosstodon.org/media_attachments/files/109/794/074/904/068/648/original/98a8994f90dc97a6.jpeg",
            "name": null,
            "blurhash": "UHFrw??a4mkDxuxas-ae9Eog-=s:ITRPa|bI",
            "width": 1663,
            "height": 1247
        }
    ],
    "tag": [],
    "replies": {
        "id": "https://fosstodon.org/users/dellagustin/statuses/109794075204000680/replies",
        "type": "Collection",
        "first": {
            "type": "CollectionPage",
            "next": "https://fosstodon.org/users/dellagustin/statuses/109794075204000680/replies?only_other_accounts=true&page=true",
            "partOf": "https://fosstodon.org/users/dellagustin/statuses/109794075204000680/replies",
            "items": []
        }
    }
}

Related issues and commits

johnspurlock-skymethod commented 1 year ago

🤦‍♂️

Sorry, you can tell the level of testing I did on that change - I'll take a look

johnspurlock-skymethod commented 1 year ago

I think it's because that instance is returning null, instead of undefined or string.

This should fix it, but I'm going to deploy it to the livewire validator and throw a few test threads at it

https://github.com/skymethod/minipub/commit/5ce6b08e3de06b6afc6603b92d4ae33216897712

johnspurlock-skymethod commented 1 year ago

Looks good on my side - published 0.1.11 with the fix

dellagustin commented 1 year ago

🤦‍♂️

Sorry, you can tell the level of testing I did on that change - I'll take a look

happens to the best of us 😄, I'll retest, thank you for the fix!

dellagustin commented 1 year ago

Tested, it worked for me. Thanks again for the updates.