Open kailan opened 7 years ago
Caused by permission checks querying for the announceable/linkable of each entry.
Is there really all that much that can be done about this without creating security issues around permissions?
@gxrneyme Unfortunately our ORM doesn't support the kind of query we need to be able to fix this, so this is kind of an on-hold issue until it does (or we implement it ourselves).
What were you thinking in terms of queries, @kailan?
@gxrneyme When fetching the announcements/links, we need to add include(:announceable)
, include(:linkable)
to the query to also fetch the place that the announcement/link was posted in.
Unfortunately we can't do that, since Mongoid doesn't support the pre-fetching of polymorphic associations.
This could be mitigated for certain views such as departments/activities by only running the permission check once (instead of for each link) since we know that the results are all the same.
@kailan Good thinking on the departments/activities front — would likely speed things up a lot. Will take a look sometime and see if I can put you a PR together.