Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug when filtering by org and all locales
Previously, if the query included `locales: all` and contained link_filters then we'd receive an SQL error: ``` PG::UndefinedTable: ERROR: missing FROM-clause entry for table "documents" LINE 1: ...s" INNER JOIN link_sets ON link_sets.content_id = documents.... ``` This only occurred when using the `all` value for a locale due to the `documents` join being skipped [1] and so then the link_sets join failed [2] due to missing the `documents` table declaration. To mitigate this, we've added the document join to the default scope as it is unlikely we'd query without a document. [1]: https://github.com/alphagov/publishing-api/blob/ff491b745bf7cfdd3ff8fba6dabbdabbe40c9150/app/queries/get_content_collection.rb#L52 [2]: https://github.com/alphagov/publishing-api/blob/ff491b745bf7cfdd3ff8fba6dabbdabbe40c9150/app/models/link.rb#L13
- Loading branch information