Skip to content

Conversation

@grahhnt
Copy link
Contributor

@grahhnt grahhnt commented Jan 3, 2026

Allows createMessage to correctly pull 'to' & 'cc' properties from the AP object to follow json-ld spec

Similar change is present elsewhere (like ActivityPubManager#createInboxesFromCC)

From a similar contribution:

JSON-LD allows for arrays to be specified by just their first value

I cannot find the specification at the moment, but the json-ld.org playground (linked from w3.org) shows this

Activity with solo To object (playground) vs Activity with array of a single To value (playground)

This change will allow for implementations that use npm jsonld (like fedify) to correctly interact with Piefed

@melroy89 melroy89 requested a review from BentiGorlich January 3, 2026 13:17
@BentiGorlich
Copy link
Member

Thanks for bringing this to our attention :)

I think this change would work, but we should implement it in all the places and not just adjust one specific one. If you search the project for reads on this property via ['to'] you'll find a lot of those. The to and cc properties are the most prominent arrays that might contain only one value, but there are more.

However if it is too much work for you, then we can close this PR and open an issue, so we can work on it when we have time :)

@grahhnt
Copy link
Contributor Author

grahhnt commented Jan 3, 2026

I have gone through and found the common occurrences of 'to' & 'cc' being accessed and replaced them with a new utility class & method, JsonldUtils::getArrayValue

I have also ran php-cs-fixer to resolve that failed test

Copy link
Member

@BentiGorlich BentiGorlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good, thanks for the work. I think there are a lot more occurrances, but I can always expand that later on. I just have 2 style comments :)

@BentiGorlich BentiGorlich merged commit 411443f into MbinOrg:main Jan 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants