diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-08-15 11:27:37 +0100 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2017-09-07 13:01:59 +0100 |
commit | cfd475a45ee2655fa0148b0b561f95b44fe8641b (patch) | |
tree | 84bc8f20239d58ed19e35cb515c50d3b36735c4f /app/controllers | |
parent | d1b60cbc67dc14b21820ef3f823a8e1ea851697d (diff) | |
download | gitlab-ce-cfd475a45ee2655fa0148b0b561f95b44fe8641b.tar.gz |
Removes default scope from sortable23079-remove-default-scope-in-sortable
Diffstat (limited to 'app/controllers')
8 files changed, 15 insertions, 9 deletions
diff --git a/app/controllers/admin/broadcast_messages_controller.rb b/app/controllers/admin/broadcast_messages_controller.rb index 762e36ee2e9..c49b6459452 100644 --- a/app/controllers/admin/broadcast_messages_controller.rb +++ b/app/controllers/admin/broadcast_messages_controller.rb @@ -2,7 +2,7 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController before_action :finder, only: [:edit, :update, :destroy] def index - @broadcast_messages = BroadcastMessage.reorder("ends_at DESC").page(params[:page]) + @broadcast_messages = BroadcastMessage.order(ends_at: :desc).page(params[:page]) @broadcast_message = BroadcastMessage.new end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index 05e749c00c0..e85cdcb8db7 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -1,7 +1,7 @@ class Admin::DashboardController < Admin::ApplicationController def index - @projects = Project.without_deleted.with_route.limit(10) - @users = User.limit(10) - @groups = Group.with_route.limit(10) + @projects = Project.order_id_desc.without_deleted.with_route.limit(10) + @users = User.order_id_desc.limit(10) + @groups = Group.order_id_desc.with_route.limit(10) end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index a99563b7100..9ec7719fabb 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -17,7 +17,7 @@ class Admin::UsersController < Admin::ApplicationController end def keys - @keys = user.keys + @keys = user.keys.order_id_desc end def new diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb index 742157d113d..8057a0b455c 100644 --- a/app/controllers/dashboard/groups_controller.rb +++ b/app/controllers/dashboard/groups_controller.rb @@ -1,5 +1,7 @@ class Dashboard::GroupsController < Dashboard::ApplicationController def index + @sort = params[:sort] || 'id_desc' + @groups = if params[:parent_id] && Group.supports_nested_groups? parent = Group.find_by(id: params[:parent_id]) @@ -15,7 +17,7 @@ class Dashboard::GroupsController < Dashboard::ApplicationController @groups = @groups.search(params[:filter_groups]) if params[:filter_groups].present? @groups = @groups.includes(:route) - @groups = @groups.sort(@sort = params[:sort]) + @groups = @groups.sort(@sort) @groups = @groups.page(params[:page]) respond_to do |format| diff --git a/app/controllers/profiles/emails_controller.rb b/app/controllers/profiles/emails_controller.rb index 17b66df43e7..ddb67d1c4d1 100644 --- a/app/controllers/profiles/emails_controller.rb +++ b/app/controllers/profiles/emails_controller.rb @@ -1,7 +1,7 @@ class Profiles::EmailsController < Profiles::ApplicationController def index @primary = current_user.email - @emails = current_user.emails + @emails = current_user.emails.order_id_desc end def create diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb index 88f49da555a..f9f0e8eef83 100644 --- a/app/controllers/profiles/keys_controller.rb +++ b/app/controllers/profiles/keys_controller.rb @@ -2,7 +2,7 @@ class Profiles::KeysController < Profiles::ApplicationController skip_before_action :authenticate_user!, only: [:get_keys] def index - @keys = current_user.keys + @keys = current_user.keys.order_id_desc @key = Key.new end diff --git a/app/controllers/projects/merge_requests/diffs_controller.rb b/app/controllers/projects/merge_requests/diffs_controller.rb index 330b7df4541..63d61c98f34 100644 --- a/app/controllers/projects/merge_requests/diffs_controller.rb +++ b/app/controllers/projects/merge_requests/diffs_controller.rb @@ -27,7 +27,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic @merge_request.merge_request_diff end - @merge_request_diffs = @merge_request.merge_request_diffs.viewable.select_without_diff + @merge_request_diffs = @merge_request.merge_request_diffs.viewable.select_without_diff.order_id_desc @comparable_diffs = @merge_request_diffs.select { |diff| diff.id < @merge_request_diff.id } if params[:start_sha].present? diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index f8ff7413b53..d925dcd21ff 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -47,6 +47,10 @@ class Projects::ProjectMembersController < Projects::ApplicationController end end + def import + @projects = current_user.authorized_projects.order_id_desc + end + def apply_import source_project = Project.find(params[:source_project_id]) |