Files
gitlabhq/app/models
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
..
2016-03-14 13:33:26 +01:00
2016-01-15 00:35:12 +03:00
2011-10-09 00:36:38 +03:00
2016-03-22 00:09:20 +01:00
2016-03-15 21:09:25 +01:00
2016-02-26 15:50:51 +01:00
2015-08-03 01:52:54 +09:00
2016-03-07 14:27:53 +01:00
2016-01-29 13:39:33 -05:00
2016-03-03 18:38:44 +01:00
2015-05-03 13:38:27 -07:00
2015-04-03 12:28:47 +02:00
2016-01-06 13:09:55 +00:00
2016-03-06 23:07:19 -05:00
2016-03-22 00:09:20 +01:00
2016-01-12 12:29:10 -02:00
2015-12-18 14:19:48 -06:00
2014-08-25 12:25:02 +03:00
2016-03-22 15:29:57 -03:00
2015-12-08 21:00:01 -08:00
2015-12-08 21:00:01 -08:00
2016-03-05 18:12:17 -05:00
2015-05-03 13:38:27 -07:00
2016-03-05 18:12:17 -05:00
2015-11-13 19:22:46 +01:00
2015-08-03 01:52:54 +09:00
2016-03-18 13:27:27 -03:00
2016-03-19 21:24:05 +01:00
2016-03-16 02:17:07 +09:00