Commit f4a84f50 authored by Paco Guzman's avatar Paco Guzman

Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes without references

parent 684baf7e
...@@ -5,6 +5,7 @@ v 8.13.0 (unreleased) ...@@ -5,6 +5,7 @@ v 8.13.0 (unreleased)
- Speed-up group milestones show page - Speed-up group milestones show page
- Log LDAP lookup errors and don't swallow unrelated exceptions. !6103 (Markus Koller) - Log LDAP lookup errors and don't swallow unrelated exceptions. !6103 (Markus Koller)
- Add more tests for calendar contribution (ClemMakesApps) - Add more tests for calendar contribution (ClemMakesApps)
- Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes without references
- Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison) - Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
- Only update issuable labels if they have been changed - Only update issuable labels if they have been changed
- Revoke button in Applications Settings underlines on hover. - Revoke button in Applications Settings underlines on hover.
......
...@@ -79,7 +79,11 @@ module Banzai ...@@ -79,7 +79,11 @@ module Banzai
def referenced_by(nodes) def referenced_by(nodes)
ids = unique_attribute_values(nodes, self.class.data_attribute) ids = unique_attribute_values(nodes, self.class.data_attribute)
references_relation.where(id: ids) if ids.empty?
references_relation.none
else
references_relation.where(id: ids)
end
end end
# Returns the ActiveRecord::Relation to use for querying references in the # Returns the ActiveRecord::Relation to use for querying references in the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment