context: Object { actionCode: "bid", post: undefined }
The test does not check the parameters, so this goes unnoticed.
I guess the post parameter should be this.args.post and not this.post.
I’ve been trying a workaround by unconditionally adding the component and having it check itself what to do but unfortunately it seems like the arguments are not being passed correctly either so both the workaround and a normal implementation fail here as well:
There are getters in PostSmallAction for code, createdAt and path, but (again) this.post does not exist and username() seems to have a bug as well (there is no action_code_who in this.args.post ?) , so those attributes stay empty.
I can’t find an existing “real world” implementation. Am I really the first one to use this ?
You’re correct; the post parameter should be this.args.post instead of this.post.
username is a bit misleading here. action_code_who is indeed correct but is used by some plugins like the assign plugin, so it’s not always present in the post object. To get the user who created the small action, you can use @post.username
I wasn’t sure if I could push changes to your PR, so I opened the one below to address these issues:
fix the post argument passed both to the transformer and the custom component
rename the username argument to who minimizing the confusion around this argument
add tests to verify the arguments are passed correctly
AFAIK, the old API wasn’t used in any of the customizations we track in the all-the-* repos. I only added this one to provide an alternative in case a self-hoster was using it.