diff --git a/app/controllers/global_activities_controller.rb b/app/controllers/global_activities_controller.rb index dd83dde77..a52d40e2a 100644 --- a/app/controllers/global_activities_controller.rb +++ b/app/controllers/global_activities_controller.rb @@ -69,7 +69,7 @@ class GlobalActivitiesController < ApplicationController end def team_filter - render json: current_user.teams.order('LOWER(name)').global_activity_filter(activity_filters, params[:query]) + render json: current_user.teams.ordered.global_activity_filter(activity_filters, params[:query]) end def user_filter diff --git a/app/models/team.rb b/app/models/team.rb index 03e0c8fe5..da0b661a4 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -12,6 +12,7 @@ class Team < ApplicationRecord after_create :generate_template_project scope :teams_select, -> { select(:id, :name).order(name: :asc) } + scope :ordered, -> { order('LOWER(name)') } auto_strip_attributes :name, :description, nullify: false validates :name, diff --git a/app/views/shared/_navigation.html.erb b/app/views/shared/_navigation.html.erb index fc3483136..b7ba89280 100644 --- a/app/views/shared/_navigation.html.erb +++ b/app/views/shared/_navigation.html.erb @@ -73,7 +73,7 @@ <%= hidden_field(:user, :current_team_id) %>