Skip to content
Snippets Groups Projects
Commit 8952fc01 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Apply default scope to labels and remove one for notes

parent c5be267e
No related branches found
No related tags found
1 merge request!8686add "Uplaod" and "Replace" functionality
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -11,8 +11,6 @@
#
 
class Label < ActiveRecord::Base
include Sortable
DEFAULT_COLOR = '#428BCA'
 
belongs_to :project
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment