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

perf: only load user state when showing full user data #50

Closed SychO9 closed 4 months ago

SychO9 commented 7 months ago

Fof terms only needs the serialized state for the modal to see if a user accepted, this can be optimized by lazy loading the full user data from the modal.

The other attributes are only needed for the current user serialization.

This prevents unnecessary querying of the terms state when serializing discussion & post authors in other endpoints. Solves a massive slowdown with big data.

imorland commented 3 months ago

@SychO9 I've reverted this change for now due to https://discuss.flarum.org/d/11714-fof-terms-ask-your-users-to-accept-tos-and-privacy-policy/177

Could you please take a look at this and submit a new PR when possible? Thanks