diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb index 0a85c36a758267114228f99b3dc1c12536a8a521..b133afe44b577416b0b71a5417ff6135ebf3c73e 100644 --- a/app/controllers/projects/commits_controller.rb +++ b/app/controllers/projects/commits_controller.rb @@ -13,7 +13,7 @@ class Projects::CommitsController < Projects::ApplicationController @commits = @repo.commits(@ref, @path, @limit, @offset) @note_counts = Note.where(commit_id: @commits.map(&:id)). - group(:commit_id).count + group(:commit_id).count respond_to do |format| format.html diff --git a/app/controllers/projects/labels_controller.rb b/app/controllers/projects/labels_controller.rb index 6c7bde9c5d5544dac846842f48a3e5c26429379c..b61fef3b6276421dd2d5b61dbd4cd7ed0fd8f881 100644 --- a/app/controllers/projects/labels_controller.rb +++ b/app/controllers/projects/labels_controller.rb @@ -7,7 +7,7 @@ class Projects::LabelsController < Projects::ApplicationController respond_to :js, :html def index - @labels = @project.labels.order_by_name.page(params[:page]).per(20) + @labels = @project.labels.page(params[:page]).per(20) end def new diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 912f9eb5b6b0be6e5fa920208860073ecb18e2fc..01be318ede21f22e157e652bcd65423cee8d697b 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -23,7 +23,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController def show @note_counts = Note.where(commit_id: @merge_request.commits.map(&:id)). - group(:commit_id).count + group(:commit_id).count respond_to do |format| format.html diff --git a/app/finders/notes_finder.rb b/app/finders/notes_finder.rb index 6fe15b410605a93fdb836edb08512f36b0b15d84..e2bd0a2560e57c5d08a0d6c665253152b755c89f 100644 --- a/app/finders/notes_finder.rb +++ b/app/finders/notes_finder.rb @@ -22,6 +22,7 @@ class NotesFinder end # Use overlapping intervals to avoid worrying about race conditions - notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP) + notes.where('updated_at > ?', last_fetched_at - FETCH_OVERLAP). + order(created_at: :asc, id: :asc) end end diff --git a/app/models/label.rb b/app/models/label.rb index c8f6a7cd48c4ca42a4c3189486aa11c12578ebeb..9d7099c5652db38d914eae00a3e5823a37813f28 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -11,8 +11,6 @@ # class Label < ActiveRecord::Base - include Sortable - DEFAULT_COLOR = '#428BCA' belongs_to :project @@ -30,7 +28,7 @@ class Label < ActiveRecord::Base format: { with: /\A[^&\?,&]+\z/ }, uniqueness: { scope: :project_id } - scope :order_by_name, -> { reorder("labels.title ASC") } + default_scope { order(title: :asc) } alias_attribute :name, :title diff --git a/app/models/note.rb b/app/models/note.rb index a3f2980cebd236c585c180a46fa8091d67ca42d2..0b988cc3e0f409d63e240ae0beb3a7ac1b694d8e 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -23,7 +23,6 @@ require 'file_size_validator' class Note < ActiveRecord::Base include Mentionable - default_scope { order(created_at: :asc, id: :asc) } default_value_for :system, false attr_mentionable :note diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml index 4f683258facdfa6e94e208e15ef24a8f8c4e270d..cd97481bb6ce24a9c2ce70d7616ca9a0224b4024 100644 --- a/app/views/shared/_issuable_filter.html.haml +++ b/app/views/shared/_issuable_filter.html.haml @@ -98,7 +98,7 @@ = link_to page_filter_path(label_name: nil) do Any - if @project.labels.any? - - @project.labels.order_by_name.each do |label| + - @project.labels.each do |label| %li = link_to page_filter_path(label_name: label.name) do = render_colored_label(label)