discourse-follow/spec/integration
Osama Sayegh 188045495d
FIX: Don't include the plugin attributes when serializing more than 1 user objects (#49)
The `/user-cards.json` route in core serializes multiple `User` objects using the `UserCardSerializer` which means that, in order to avoid N+1 queries, we need to preload all the associations of the `User` model that are needed for the serialization. However, the follow plugin adds a few attributes to the `UserCardSerializer` that depend on associations defined by the plugin, but there is no official API for extending [the set of preloaded associations](a560f9d44b/app/controllers/users_controller.rb (L112-L120)) when serializing objects for the `/user-cards.json` route.

This PR adds a temporary hack to exclude the attributes added by the plugin from the `UserCardSerializer` when it's being used for the `/user-cards.json` (but not the single-user user card route `/u/<username>/card.json`. We'll remove this hack once we have an official API for preloading additional associations for the `/user-cards.json` route.

Meta topic: https://meta.discourse.org/t/follow-plugin/110579/315?u=osama.
2022-01-27 10:56:14 +03:00
..
follow_notifications_spec.rb FIX: Hide follower status to users with hidden profiles (#45) 2021-12-30 10:34:55 +11:00
user_cards_route_spec.rb FIX: Don't include the plugin attributes when serializing more than 1 user objects (#49) 2022-01-27 10:56:14 +03:00
user_destroyer_spec.rb DEV: Plugin cleanup (#1) 2021-10-07 20:34:07 +03:00