diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-11-07 17:11:37 +0100 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-11-08 12:22:11 +0100 |
commit | fec48c6e170fb0032cece5d8cc3b06bb45caee57 (patch) | |
tree | fc281a6272bc9f0670b01cea1134bda123435907 /app/services | |
parent | dc1e6b436268c00bd1fdf3d15597a4656e029b95 (diff) | |
download | gitlab-ce-fec48c6e170fb0032cece5d8cc3b06bb45caee57.tar.gz |
Use Commit#notes and Note.for_commit_id when possible to make sure we use all the indexes available to usdm-notes-for-commit-id
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/system_note_service.rb | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 69bd19c1977..e946218824c 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -481,17 +481,7 @@ module SystemNoteService # # Returns Boolean def cross_reference_exists?(noteable, mentioner) - # Initial scope should be system notes of this noteable type - notes = Note.system.where(noteable_type: noteable.class) - - notes = - if noteable.is_a?(Commit) - # Commits have non-integer IDs, so they're stored in `commit_id` - notes.where(commit_id: noteable.id) - else - notes.where(noteable_id: noteable.id) - end - + notes = noteable.notes.system notes_for_mentioner(mentioner, noteable, notes).exists? end |