Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
8952fc01
Commit
8952fc01
authored
Feb 05, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply default scope to labels and remove one for notes
parent
c5be267e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
9 deletions
+7
-9
app/controllers/projects/commits_controller.rb
app/controllers/projects/commits_controller.rb
+1
-1
app/controllers/projects/labels_controller.rb
app/controllers/projects/labels_controller.rb
+1
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+2
-1
app/models/label.rb
app/models/label.rb
+1
-3
app/models/note.rb
app/models/note.rb
+0
-1
app/views/shared/_issuable_filter.html.haml
app/views/shared/_issuable_filter.html.haml
+1
-1
No files found.
app/controllers/projects/commits_controller.rb
View file @
8952fc01
...
@@ -13,7 +13,7 @@ class Projects::CommitsController < Projects::ApplicationController
...
@@ -13,7 +13,7 @@ class Projects::CommitsController < Projects::ApplicationController
@commits
=
@repo
.
commits
(
@ref
,
@path
,
@limit
,
@offset
)
@commits
=
@repo
.
commits
(
@ref
,
@path
,
@limit
,
@offset
)
@note_counts
=
Note
.
where
(
commit_id:
@commits
.
map
(
&
:id
)).
@note_counts
=
Note
.
where
(
commit_id:
@commits
.
map
(
&
:id
)).
group
(
:commit_id
).
count
group
(
:commit_id
).
count
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
...
app/controllers/projects/labels_controller.rb
View file @
8952fc01
...
@@ -7,7 +7,7 @@ class Projects::LabelsController < Projects::ApplicationController
...
@@ -7,7 +7,7 @@ class Projects::LabelsController < Projects::ApplicationController
respond_to
:js
,
:html
respond_to
:js
,
:html
def
index
def
index
@labels
=
@project
.
labels
.
order_by_name
.
page
(
params
[
:page
]).
per
(
20
)
@labels
=
@project
.
labels
.
page
(
params
[
:page
]).
per
(
20
)
end
end
def
new
def
new
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
8952fc01
...
@@ -23,7 +23,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -23,7 +23,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
show
def
show
@note_counts
=
Note
.
where
(
commit_id:
@merge_request
.
commits
.
map
(
&
:id
)).
@note_counts
=
Note
.
where
(
commit_id:
@merge_request
.
commits
.
map
(
&
:id
)).
group
(
:commit_id
).
count
group
(
:commit_id
).
count
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
...
app/finders/notes_finder.rb
View file @
8952fc01
...
@@ -22,6 +22,7 @@ class NotesFinder
...
@@ -22,6 +22,7 @@ class NotesFinder
end
end
# Use overlapping intervals to avoid worrying about race conditions
# 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
end
end
app/models/label.rb
View file @
8952fc01
...
@@ -11,8 +11,6 @@
...
@@ -11,8 +11,6 @@
#
#
class
Label
<
ActiveRecord
::
Base
class
Label
<
ActiveRecord
::
Base
include
Sortable
DEFAULT_COLOR
=
'#428BCA'
DEFAULT_COLOR
=
'#428BCA'
belongs_to
:project
belongs_to
:project
...
@@ -30,7 +28,7 @@ class Label < ActiveRecord::Base
...
@@ -30,7 +28,7 @@ class Label < ActiveRecord::Base
format:
{
with:
/\A[^&\?,&]+\z/
},
format:
{
with:
/\A[^&\?,&]+\z/
},
uniqueness:
{
scope: :project_id
}
uniqueness:
{
scope: :project_id
}
scope
:order_by_name
,
->
{
reorder
(
"labels.title ASC"
)
}
default_scope
{
order
(
title: :asc
)
}
alias_attribute
:name
,
:title
alias_attribute
:name
,
:title
...
...
app/models/note.rb
View file @
8952fc01
...
@@ -23,7 +23,6 @@ require 'file_size_validator'
...
@@ -23,7 +23,6 @@ require 'file_size_validator'
class
Note
<
ActiveRecord
::
Base
class
Note
<
ActiveRecord
::
Base
include
Mentionable
include
Mentionable
default_scope
{
order
(
created_at: :asc
,
id: :asc
)
}
default_value_for
:system
,
false
default_value_for
:system
,
false
attr_mentionable
:note
attr_mentionable
:note
...
...
app/views/shared/_issuable_filter.html.haml
View file @
8952fc01
...
@@ -98,7 +98,7 @@
...
@@ -98,7 +98,7 @@
=
link_to
page_filter_path
(
label_name:
nil
)
do
=
link_to
page_filter_path
(
label_name:
nil
)
do
Any
Any
-
if
@project
.
labels
.
any?
-
if
@project
.
labels
.
any?
-
@project
.
labels
.
order_by_name
.
each
do
|
label
|
-
@project
.
labels
.
each
do
|
label
|
%li
%li
=
link_to
page_filter_path
(
label_name:
label
.
name
)
do
=
link_to
page_filter_path
(
label_name:
label
.
name
)
do
=
render_colored_label
(
label
)
=
render_colored_label
(
label
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment