Accept all standard actor types #751

Merged
floatingghost merged 1 commit from Oneric/akkoma:all-actor-types into develop 2024-04-24 17:09:02 +00:00
Member

Sorry i missed this type, now the validator covers all standard ones listed in https://www.w3.org/TR/activitystreams-vocabulary/#actor-types and we now have real-world test samples for each one

Fixes https://meta.akkoma.dev/t/unable-to-follow-bots/705

Sorry i missed this type, now the validator covers all standard ones listed in https://www.w3.org/TR/activitystreams-vocabulary/#actor-types and we now have real-world test samples for each one Fixes https://meta.akkoma.dev/t/unable-to-follow-bots/705
floatingghost reviewed 2024-04-23 15:28:50 +00:00
@ -21,3 +21,3 @@
def validate(%{"type" => type, "id" => _id} = data, meta)
when type in ["Person", "Organization", "Group", "Application"] do
when type in ["Person", "Organization", "Group", "Application", "Service"] do

you can probably use Pleroma.Constants.actor_types here to avoid any issues like this popping up again

you can probably use Pleroma.Constants.actor_types here to avoid any issues like this popping up again
Author
Member

oh, id din’t knew we have this — but Pleroma.Constants.actor_types() is still a function call not a real compile-time constant so it can’t be used in a guard expression. uhhh, ex_const docs claim it already creates macros and those can be used in guards etc, but i get a compiler error when i try

Is there a way to access Pleroma.Constatnts stuff as actual constants?

oh, id din’t knew we have this — but `Pleroma.Constants.actor_types()` ~~is still a function call~~ not a real compile-time constant so it can’t be used in a guard expression. uhhh, `ex_const` docs claim it already creates macros and those can be used in guards etc, but i get a compiler error when i try Is there a way to access `Pleroma.Constatnts` stuff as _actual_ constants?

according to ex_const's docs, you can use them in guards

i'll have to check for myself if this works in reality though 🥴

according to [ex_const's docs](https://github.com/jcomellas/ex_const?tab=readme-ov-file#single-constants), you _can_ use them in guards i'll have to check for myself if this works in reality though 🥴
Author
Member

ok, it actually does work when used correctly

i initially didn’t add require Pleroma.Constants and got a compiler error about “expected a compile-time constant” which confused me. Will push once tests finish

ok, it actually _does_ work when used correctly i initially didn’t add `require Pleroma.Constants` and got a compiler error about “expected a compile-time constant” which confused me. Will push once tests finish

i think it was added in the failed fetch processing PR we yoinked, so it's a new constant

i think it was added in the failed fetch processing PR we yoinked, so it's a new constant
Oneric marked this conversation as resolved
Oneric force-pushed all-actor-types from 25d267bc76 to 83f75c3e93 2024-04-23 16:16:45 +00:00 Compare

thankies~

thankies~
floatingghost merged commit 764dbeded4 into develop 2024-04-24 17:09:02 +00:00
floatingghost deleted branch all-actor-types 2024-04-24 17:09:02 +00:00
Sign in to join this conversation.
No description provided.