gitlab-org--gitlab-foss/spec/controllers
Douwe Maan 703f7c5d57 Merge branch 'fix-sorting-by-votes-on-groups-page' into 'master'
Fix sorting issues/mrs by votes on the groups page

Closes #14394 

The `non_archived` scope applied here https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/controllers/concerns/issues_action.rb#L5 overrides the previous `ORDER BY` applied inside the IssuesFinder, with the default scope of the Project model, resulting in SQL errors.

```ruby
Issue.reorder(created_at: :desc).joins(:project).to_sql
=> "SELECT issues.* 
    FROM issues INNER JOIN projects ON projects.id = issues.project_id
    ORDER BY issues.created_at DESC"

Issue.reorder(created_at: :desc).joins(:project).merge(Project.non_archived).to_sql
=> "SELECT issues.* 
    FROM issues INNER JOIN projects ON projects.id = issues.project_id 
    WHERE projects.archived = 'f'
    ORDER BY projects.id DESC"

Issue.reorder(created_at: :desc).joins(:project).merge(Project.non_archived.only(:where)).to_sql
=> "SELECT issues.* 
    FROM issues INNER JOIN projects ON projects.id = issues.project_id 
    WHERE projects.archived = 'f'
    ORDER BY issues.created_at DESC"
```

/cc @yorickpeterse 

See merge request !3333
2016-03-23 10:35:54 +00:00
..
admin Fix rubocop offenses 2016-02-02 11:25:44 -02:00
ci Do not require authentication for CI status badge 2016-03-01 20:32:30 +01:00
groups Fix more specs 2016-03-20 23:09:33 +01:00
import Fix duplicate repositories in GitHub import page 2015-10-19 10:39:59 -07:00
profiles Revert "Merge branch 'avatar-cropping' into 'master' " 2016-03-15 14:55:40 +01:00
projects Merge branch 'master' into issue_12658 2016-03-21 23:22:21 +01:00
abuse_reports_controller_spec.rb Add AbuseReport#notify 2016-01-04 18:59:42 -05:00
application_controller_spec.rb Fix some specs 2016-03-20 22:55:08 +01:00
autocomplete_controller_spec.rb Merge branch 'fix-autocomplete-spec' into 'master' 2016-02-23 10:11:39 +01:00
blob_controller_spec.rb Fix Style/AlignHash cop violations 2015-06-22 22:24:39 -07:00
commit_controller_spec.rb Use Gitlab::Git::DiffCollections 2016-03-03 18:38:44 +01:00
groups_controller_spec.rb Fix sorting issues/mrs by votes on the groups page 2016-03-21 17:01:38 -03:00
help_controller_spec.rb Fix Style/AlignHash cop violations 2015-06-22 22:24:39 -07:00
invites_controller_spec.rb Redirect to a default path if HTTP_REFERER is not set 2015-10-20 07:45:48 -07:00
namespaces_controller_spec.rb Fix more specs 2016-03-20 23:09:33 +01:00
projects_controller_spec.rb Remove unnecessary go-get test (superseded by middleware) 2016-03-12 11:14:56 -08:00
root_controller_spec.rb Add user preference to view project activity and starred project activity as default dashboard 2015-09-26 08:46:05 -07:00
sent_notifications_controller_spec.rb Move a few controller specs to their correct locations 2016-02-18 21:50:49 -05:00
snippets_controller_spec.rb Fix raw private snippets access workflow 2015-11-25 18:16:27 -02:00
uploads_controller_spec.rb Fix more specs 2016-03-20 23:09:33 +01:00
users_controller_spec.rb include contributions from forked projects on profile calendar 2016-02-22 15:46:29 +01:00