FriendsOfFlarum / terms

Ask your users to accept TOS and Privacy Policy
https://discuss.flarum.org/d/11714
MIT License
14 stars 10 forks source link

return data after adding fields #4

Closed sijad closed 6 years ago

sijad commented 6 years ago

should fix #3, not tired it though.

clarkwinkelmann commented 6 years ago

Please correct me if I'm wrong but I'm certain this won't change anything at all.

the extend() helper allows you to work with the return value but doesn't do anything with that you return https://github.com/flarum/core/blob/c6aeeeb3c1d5cf92c586c9f8ee43d2127d0fb933/js/lib/extend.js#L27 Because the object is passed as reference the changes from any extensions should be preserved.

You would have to use override() for that. I notice that you create a "copy" of the object and return it in the recaptcha extension. I believe this code does nothing, you could just add the value directly to the original object.

sijad commented 6 years ago

Thanks for the heads up, in this case I'm going to use override instead, altering the reference seems hacky and not very clean.

I notice that you create a "copy" of the object and return it in the recaptcha extension. I believe this code does nothing, you could just add the value directly to the original object.

yea, my old linter used to say never do anything to input parameters.