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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
8a4d68c5
Commit
8a4d68c5
authored
Feb 21, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Style/ConditionalAssignment
parent
7ea641b6
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
100 additions
and
104 deletions
+100
-104
.rubocop.yml
.rubocop.yml
+3
-0
.rubocop_todo.yml
.rubocop_todo.yml
+0
-7
app/controllers/concerns/creates_commit.rb
app/controllers/concerns/creates_commit.rb
+3
-3
app/controllers/projects/git_http_client_controller.rb
app/controllers/projects/git_http_client_controller.rb
+3
-3
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+3
-3
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+3
-3
app/finders/notes_finder.rb
app/finders/notes_finder.rb
+3
-3
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+3
-3
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+3
-3
app/mailers/repository_check_mailer.rb
app/mailers/repository_check_mailer.rb
+3
-3
app/models/commit.rb
app/models/commit.rb
+3
-3
app/models/concerns/case_sensitivity.rb
app/models/concerns/case_sensitivity.rb
+3
-3
app/models/concerns/sortable.rb
app/models/concerns/sortable.rb
+3
-3
app/models/network/graph.rb
app/models/network/graph.rb
+3
-3
app/models/project.rb
app/models/project.rb
+3
-3
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+4
-4
app/services/system_note_service.rb
app/services/system_note_service.rb
+3
-3
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+6
-6
lib/banzai/filter/abstract_reference_filter.rb
lib/banzai/filter/abstract_reference_filter.rb
+3
-3
lib/banzai/filter/gollum_tags_filter.rb
lib/banzai/filter/gollum_tags_filter.rb
+3
-3
lib/banzai/filter/issue_reference_filter.rb
lib/banzai/filter/issue_reference_filter.rb
+3
-3
lib/gitlab/award_emoji.rb
lib/gitlab/award_emoji.rb
+3
-3
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+3
-3
lib/gitlab/diff/position.rb
lib/gitlab/diff/position.rb
+3
-3
lib/gitlab/email/reply_parser.rb
lib/gitlab/email/reply_parser.rb
+3
-3
lib/gitlab/metrics/instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+3
-3
lib/gitlab/saml/user.rb
lib/gitlab/saml/user.rb
+3
-3
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+6
-6
lib/gitlab/sherlock/query.rb
lib/gitlab/sherlock/query.rb
+3
-3
spec/features/issuables/issuable_list_spec.rb
spec/features/issuables/issuable_list_spec.rb
+3
-3
spec/support/issuables_list_metadata_shared_examples.rb
spec/support/issuables_list_metadata_shared_examples.rb
+3
-3
spec/support/login_helpers.rb
spec/support/login_helpers.rb
+3
-3
No files found.
.rubocop.yml
View file @
8a4d68c5
...
@@ -965,5 +965,8 @@ Style/ColonMethodCall:
...
@@ -965,5 +965,8 @@ Style/ColonMethodCall:
Style/CommentAnnotation
:
Style/CommentAnnotation
:
Enabled
:
false
Enabled
:
false
Style/ConditionalAssignment
:
Enabled
:
true
Style/DoubleNegation
:
Style/DoubleNegation
:
Enabled
:
false
Enabled
:
false
.rubocop_todo.yml
View file @
8a4d68c5
...
@@ -38,13 +38,6 @@ RSpec/SingleArgumentMessageChain:
...
@@ -38,13 +38,6 @@ RSpec/SingleArgumentMessageChain:
Exclude
:
Exclude
:
-
'
spec/requests/api/internal_spec.rb'
-
'
spec/requests/api/internal_spec.rb'
# Offense count: 32
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment
:
Enabled
:
false
# Offense count: 6
# Offense count: 6
# Cop supports --auto-correct.
# Cop supports --auto-correct.
Style/EachWithObject
:
Style/EachWithObject
:
...
...
app/controllers/concerns/creates_commit.rb
View file @
8a4d68c5
...
@@ -101,12 +101,12 @@ module CreatesCommit
...
@@ -101,12 +101,12 @@ module CreatesCommit
# TODO: We should really clean this up
# TODO: We should really clean this up
def
set_commit_variables
def
set_commit_variables
if
can?
(
current_user
,
:push_code
,
@project
)
@mr_source_project
=
if
can?
(
current_user
,
:push_code
,
@project
)
# Edit file in this project
# Edit file in this project
@
mr_source_project
=
@
project
@project
else
else
# Merge request from fork to this project
# Merge request from fork to this project
@mr_source_project
=
current_user
.
fork_of
(
@project
)
current_user
.
fork_of
(
@project
)
end
end
# Merge request to this project
# Merge request to this project
...
...
app/controllers/projects/git_http_client_controller.rb
View file @
8a4d68c5
...
@@ -76,10 +76,10 @@ class Projects::GitHttpClientController < Projects::ApplicationController
...
@@ -76,10 +76,10 @@ class Projects::GitHttpClientController < Projects::ApplicationController
return
@project
if
defined?
(
@project
)
return
@project
if
defined?
(
@project
)
project_id
,
_
=
project_id_with_suffix
project_id
,
_
=
project_id_with_suffix
if
project_id
.
blank?
@project
=
if
project_id
.
blank?
@project
=
nil
nil
else
else
@project
=
Project
.
find_by_full_path
(
"
#{
params
[
:namespace_id
]
}
/
#{
project_id
}
"
)
Project
.
find_by_full_path
(
"
#{
params
[
:namespace_id
]
}
/
#{
project_id
}
"
)
end
end
end
end
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
8a4d68c5
...
@@ -381,13 +381,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -381,13 +381,13 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
merge_widget_refresh
def
merge_widget_refresh
if
merge_request
.
merge_when_build_succeeds
@status
=
if
merge_request
.
merge_when_build_succeeds
@status
=
:merge_when_build_succeeds
:merge_when_build_succeeds
else
else
# Only MRs that can be merged end in this action
# Only MRs that can be merged end in this action
# MR can be already picked up for merge / merged already or can be waiting for worker to be picked up
# MR can be already picked up for merge / merged already or can be waiting for worker to be picked up
# in last case it does not have any special status. Possible error is handled inside widget js function
# in last case it does not have any special status. Possible error is handled inside widget js function
@status
=
:success
:success
end
end
render
'merge'
render
'merge'
...
...
app/controllers/sessions_controller.rb
View file @
8a4d68c5
...
@@ -15,10 +15,10 @@ class SessionsController < Devise::SessionsController
...
@@ -15,10 +15,10 @@ class SessionsController < Devise::SessionsController
def
new
def
new
set_minimum_password_length
set_minimum_password_length
if
Gitlab
.
config
.
ldap
.
enabled
@ldap_servers
=
if
Gitlab
.
config
.
ldap
.
enabled
@ldap_servers
=
Gitlab
::
LDAP
::
Config
.
servers
Gitlab
::
LDAP
::
Config
.
servers
else
else
@ldap_servers
=
[]
[]
end
end
super
super
...
...
app/finders/notes_finder.rb
View file @
8a4d68c5
...
@@ -28,10 +28,10 @@ class NotesFinder
...
@@ -28,10 +28,10 @@ class NotesFinder
private
private
def
init_collection
def
init_collection
if
@params
[
:target_id
]
@notes
=
if
@params
[
:target_id
]
@notes
=
on_target
(
@params
[
:target_type
],
@params
[
:target_id
])
on_target
(
@params
[
:target_type
],
@params
[
:target_id
])
else
else
@notes
=
notes_of_any_type
notes_of_any_type
end
end
end
end
...
...
app/helpers/application_helper.rb
View file @
8a4d68c5
...
@@ -69,10 +69,10 @@ module ApplicationHelper
...
@@ -69,10 +69,10 @@ module ApplicationHelper
end
end
def
avatar_icon
(
user_or_email
=
nil
,
size
=
nil
,
scale
=
2
)
def
avatar_icon
(
user_or_email
=
nil
,
size
=
nil
,
scale
=
2
)
if
user_or_email
.
is_a?
(
User
)
user
=
if
user_or_email
.
is_a?
(
User
)
user
=
user
_or_email
user_or_email
else
else
user
=
User
.
find_by_any_email
(
user_or_email
.
try
(
:downcase
))
User
.
find_by_any_email
(
user_or_email
.
try
(
:downcase
))
end
end
if
user
if
user
...
...
app/helpers/blob_helper.rb
View file @
8a4d68c5
...
@@ -153,15 +153,15 @@ module BlobHelper
...
@@ -153,15 +153,15 @@ module BlobHelper
# Because we are opionated we set the cache headers ourselves.
# Because we are opionated we set the cache headers ourselves.
response
.
cache_control
[
:public
]
=
@project
.
public?
response
.
cache_control
[
:public
]
=
@project
.
public?
if
@ref
&&
@commit
&&
@ref
==
@commit
.
id
response
.
cache_control
[
:max_age
]
=
if
@ref
&&
@commit
&&
@ref
==
@commit
.
id
# This is a link to a commit by its commit SHA. That means that the blob
# This is a link to a commit by its commit SHA. That means that the blob
# is immutable. The only reason to invalidate the cache is if the commit
# is immutable. The only reason to invalidate the cache is if the commit
# was deleted or if the user lost access to the repository.
# was deleted or if the user lost access to the repository.
response
.
cache_control
[
:max_age
]
=
Blob
::
CACHE_TIME_IMMUTABLE
Blob
::
CACHE_TIME_IMMUTABLE
else
else
# A branch or tag points at this blob. That means that the expected blob
# A branch or tag points at this blob. That means that the expected blob
# value may change over time.
# value may change over time.
response
.
cache_control
[
:max_age
]
=
Blob
::
CACHE_TIME
Blob
::
CACHE_TIME
end
end
response
.
etag
=
@blob
.
id
response
.
etag
=
@blob
.
id
...
...
app/mailers/repository_check_mailer.rb
View file @
8a4d68c5
class
RepositoryCheckMailer
<
BaseMailer
class
RepositoryCheckMailer
<
BaseMailer
def
notify
(
failed_count
)
def
notify
(
failed_count
)
if
failed_count
==
1
@message
=
if
failed_count
==
1
@message
=
"One project failed its last repository check"
"One project failed its last repository check"
else
else
@message
=
"
#{
failed_count
}
projects failed their last repository check"
"
#{
failed_count
}
projects failed their last repository check"
end
end
mail
(
mail
(
...
...
app/models/commit.rb
View file @
8a4d68c5
...
@@ -122,10 +122,10 @@ class Commit
...
@@ -122,10 +122,10 @@ class Commit
def
full_title
def
full_title
return
@full_title
if
@full_title
return
@full_title
if
@full_title
if
safe_message
.
blank?
@full_title
=
if
safe_message
.
blank?
@full_title
=
no_commit_message
no_commit_message
else
else
@full_title
=
safe_message
.
split
(
"
\n
"
,
2
).
first
safe_message
.
split
(
"
\n
"
,
2
).
first
end
end
end
end
...
...
app/models/concerns/case_sensitivity.rb
View file @
8a4d68c5
...
@@ -13,10 +13,10 @@ module CaseSensitivity
...
@@ -13,10 +13,10 @@ module CaseSensitivity
params
.
each
do
|
key
,
value
|
params
.
each
do
|
key
,
value
|
column
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
key
)
column
=
ActiveRecord
::
Base
.
connection
.
quote_table_name
(
key
)
if
cast_lower
condition
=
if
cast_lower
condition
=
"LOWER(
#{
column
}
) = LOWER(:value)"
"LOWER(
#{
column
}
) = LOWER(:value)"
else
else
condition
=
"
#{
column
}
= :value"
"
#{
column
}
= :value"
end
end
criteria
=
criteria
.
where
(
condition
,
value:
value
)
criteria
=
criteria
.
where
(
condition
,
value:
value
)
...
...
app/models/concerns/sortable.rb
View file @
8a4d68c5
...
@@ -46,10 +46,10 @@ module Sortable
...
@@ -46,10 +46,10 @@ module Sortable
where
(
"label_links.target_id =
#{
target_column
}
"
).
where
(
"label_links.target_id =
#{
target_column
}
"
).
reorder
(
nil
)
reorder
(
nil
)
if
target_type_column
query
=
if
target_type_column
query
=
query
.
where
(
"label_links.target_type =
#{
target_type_column
}
"
)
query
.
where
(
"label_links.target_type =
#{
target_type_column
}
"
)
else
else
query
=
query
.
where
(
label_links:
{
target_type:
target_type
})
query
.
where
(
label_links:
{
target_type:
target_type
})
end
end
query
=
query
.
where
.
not
(
title:
excluded_labels
)
if
excluded_labels
.
present?
query
=
query
.
where
.
not
(
title:
excluded_labels
)
if
excluded_labels
.
present?
...
...
app/models/network/graph.rb
View file @
8a4d68c5
...
@@ -188,10 +188,10 @@ module Network
...
@@ -188,10 +188,10 @@ module Network
end
end
# and mark it as reserved
# and mark it as reserved
if
parent_time
.
nil?
min_time
=
if
parent_time
.
nil?
min_time
=
leaves
.
first
.
time
leaves
.
first
.
time
else
else
min_time
=
parent_time
+
1
parent_time
+
1
end
end
max_time
=
leaves
.
last
.
time
max_time
=
leaves
.
last
.
time
...
...
app/models/project.rb
View file @
8a4d68c5
...
@@ -453,12 +453,12 @@ class Project < ActiveRecord::Base
...
@@ -453,12 +453,12 @@ class Project < ActiveRecord::Base
end
end
def
add_import_job
def
add_import_job
if
forked?
job_id
=
if
forked?
job_id
=
RepositoryForkWorker
.
perform_async
(
id
,
forked_from_project
.
repository_storage_path
,
RepositoryForkWorker
.
perform_async
(
id
,
forked_from_project
.
repository_storage_path
,
forked_from_project
.
path_with_namespace
,
forked_from_project
.
path_with_namespace
,
self
.
namespace
.
full_path
)
self
.
namespace
.
full_path
)
else
else
job_id
=
RepositoryImportWorker
.
perform_async
(
self
.
id
)
RepositoryImportWorker
.
perform_async
(
self
.
id
)
end
end
if
job_id
if
job_id
...
...
app/models/project_services/pushover_service.rb
View file @
8a4d68c5
...
@@ -72,12 +72,12 @@ class PushoverService < Service
...
@@ -72,12 +72,12 @@ class PushoverService < Service
before
=
data
[
:before
]
before
=
data
[
:before
]
after
=
data
[
:after
]
after
=
data
[
:after
]
if
Gitlab
::
Git
.
blank_ref?
(
before
)
message
=
if
Gitlab
::
Git
.
blank_ref?
(
before
)
message
=
"
#{
data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
"
#{
data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
elsif
Gitlab
::
Git
.
blank_ref?
(
after
)
elsif
Gitlab
::
Git
.
blank_ref?
(
after
)
message
=
"
#{
data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
"
#{
data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
else
else
message
=
"
#{
data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
"
#{
data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
end
end
if
data
[
:total_commits_count
]
>
0
if
data
[
:total_commits_count
]
>
0
...
...
app/services/system_note_service.rb
View file @
8a4d68c5
...
@@ -408,11 +408,11 @@ module SystemNoteService
...
@@ -408,11 +408,11 @@ module SystemNoteService
# Initial scope should be system notes of this noteable type
# Initial scope should be system notes of this noteable type
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
if
noteable
.
is_a?
(
Commit
)
notes
=
if
noteable
.
is_a?
(
Commit
)
# Commits have non-integer IDs, so they're stored in `commit_id`
# Commits have non-integer IDs, so they're stored in `commit_id`
notes
=
notes
.
where
(
commit_id:
noteable
.
id
)
notes
.
where
(
commit_id:
noteable
.
id
)
else
else
notes
=
notes
.
where
(
noteable_id:
noteable
.
id
)
notes
.
where
(
noteable_id:
noteable
.
id
)
end
end
notes_for_mentioner
(
mentioner
,
noteable
,
notes
).
exists?
notes_for_mentioner
(
mentioner
,
noteable
,
notes
).
exists?
...
...
config/initializers/1_settings.rb
View file @
8a4d68c5
...
@@ -14,10 +14,10 @@ class Settings < Settingslogic
...
@@ -14,10 +14,10 @@ class Settings < Settingslogic
end
end
def
build_gitlab_ci_url
def
build_gitlab_ci_url
if
on_standard_port?
(
gitlab
)
custom_port
=
if
on_standard_port?
(
gitlab
)
custom_port
=
nil
nil
else
else
custom_port
=
":
#{
gitlab
.
port
}
"
":
#{
gitlab
.
port
}
"
end
end
[
gitlab
.
protocol
,
[
gitlab
.
protocol
,
"://"
,
"://"
,
...
@@ -160,10 +160,10 @@ if github_settings
...
@@ -160,10 +160,10 @@ if github_settings
github_settings
[
"args"
]
||=
Settingslogic
.
new
({})
github_settings
[
"args"
]
||=
Settingslogic
.
new
({})
if
github_settings
[
"url"
].
include?
(
github_default_url
)
github_settings
[
"args"
][
"client_options"
]
=
if
github_settings
[
"url"
].
include?
(
github_default_url
)
github_settings
[
"args"
][
"client_options"
]
=
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
]
OmniAuth
::
Strategies
::
GitHub
.
default_options
[
:client_options
]
else
else
github_settings
[
"args"
][
"client_options"
]
=
{
{
"site"
=>
File
.
join
(
github_settings
[
"url"
],
"api/v3"
),
"site"
=>
File
.
join
(
github_settings
[
"url"
],
"api/v3"
),
"authorize_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/authorize"
),
"authorize_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/authorize"
),
"token_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/access_token"
)
"token_url"
=>
File
.
join
(
github_settings
[
"url"
],
"login/oauth/access_token"
)
...
...
lib/banzai/filter/abstract_reference_filter.rb
View file @
8a4d68c5
...
@@ -160,10 +160,10 @@ module Banzai
...
@@ -160,10 +160,10 @@ module Banzai
data
=
data_attributes_for
(
link_content
||
match
,
project
,
object
,
link:
!!
link_content
)
data
=
data_attributes_for
(
link_content
||
match
,
project
,
object
,
link:
!!
link_content
)
if
matches
.
names
.
include?
(
"url"
)
&&
matches
[
:url
]
url
=
if
matches
.
names
.
include?
(
"url"
)
&&
matches
[
:url
]
url
=
matches
[
:url
]
matches
[
:url
]
else
else
url
=
url
_for_object_cached
(
object
,
project
)
url_for_object_cached
(
object
,
project
)
end
end
content
=
link_content
||
object_link_text
(
object
,
matches
)
content
=
link_content
||
object_link_text
(
object
,
matches
)
...
...
lib/banzai/filter/gollum_tags_filter.rb
View file @
8a4d68c5
...
@@ -149,10 +149,10 @@ module Banzai
...
@@ -149,10 +149,10 @@ module Banzai
name
,
reference
=
*
parts
.
compact
.
map
(
&
:strip
)
name
,
reference
=
*
parts
.
compact
.
map
(
&
:strip
)
end
end
if
url?
(
reference
)
href
=
if
url?
(
reference
)
href
=
reference
reference
else
else
href
=
::
File
.
join
(
project_wiki_base_path
,
reference
)
::
File
.
join
(
project_wiki_base_path
,
reference
)
end
end
content_tag
(
:a
,
name
||
reference
,
href:
href
,
class:
'gfm'
)
content_tag
(
:a
,
name
||
reference
,
href:
href
,
class:
'gfm'
)
...
...
lib/banzai/filter/issue_reference_filter.rb
View file @
8a4d68c5
...
@@ -39,10 +39,10 @@ module Banzai
...
@@ -39,10 +39,10 @@ module Banzai
projects_per_reference
.
each
do
|
path
,
project
|
projects_per_reference
.
each
do
|
path
,
project
|
issue_ids
=
references_per_project
[
path
]
issue_ids
=
references_per_project
[
path
]
if
project
.
default_issues_tracker?
i
ssues
=
i
f
project
.
default_issues_tracker?
issues
=
project
.
issues
.
where
(
iid:
issue_ids
.
to_a
)
project
.
issues
.
where
(
iid:
issue_ids
.
to_a
)
else
else
issue
s
=
issue
_ids
.
map
{
|
id
|
ExternalIssue
.
new
(
id
,
project
)
}
issue_ids
.
map
{
|
id
|
ExternalIssue
.
new
(
id
,
project
)
}
end
end
issues
.
each
do
|
issue
|
issues
.
each
do
|
issue
|
...
...
lib/gitlab/award_emoji.rb
View file @
8a4d68c5
...
@@ -69,10 +69,10 @@ module Gitlab
...
@@ -69,10 +69,10 @@ module Gitlab
end
end
JSON
.
parse
(
File
.
read
(
path
)).
map
do
|
hash
|
JSON
.
parse
(
File
.
read
(
path
)).
map
do
|
hash
|
if
digest
fname
=
if
digest
fname
=
"
#{
hash
[
'unicode'
]
}
-
#{
hash
[
'digest'
]
}
"
"
#{
hash
[
'unicode'
]
}
-
#{
hash
[
'digest'
]
}
"
else
else
fname
=
hash
[
'unicode'
]
hash
[
'unicode'
]
end
end
{
name:
hash
[
'name'
],
path:
File
.
join
(
base
,
prefix
,
"
#{
fname
}
.png"
)
}
{
name:
hash
[
'name'
],
path:
File
.
join
(
base
,
prefix
,
"
#{
fname
}
.png"
)
}
...
...
lib/gitlab/conflict/file.rb
View file @
8a4d68c5
...
@@ -91,10 +91,10 @@ module Gitlab
...
@@ -91,10 +91,10 @@ module Gitlab
our_highlight
=
Gitlab
::
Highlight
.
highlight
(
our_path
,
our_file
,
repository:
repository
).
lines
our_highlight
=
Gitlab
::
Highlight
.
highlight
(
our_path
,
our_file
,
repository:
repository
).
lines
lines
.
each
do
|
line
|
lines
.
each
do
|
line
|
if
line
.
type
==
'old'
line
.
rich_text
=
if
line
.
type
==
'old'
line
.
rich_text
=
their_highlight
[
line
.
old_line
-
1
].
try
(
:html_safe
)
their_highlight
[
line
.
old_line
-
1
].
try
(
:html_safe
)
else
else
line
.
rich_text
=
our_highlight
[
line
.
new_line
-
1
].
try
(
:html_safe
)
our_highlight
[
line
.
new_line
-
1
].
try
(
:html_safe
)
end
end
end
end
end
end
...
...
lib/gitlab/diff/position.rb
View file @
8a4d68c5
...
@@ -140,10 +140,10 @@ module Gitlab
...
@@ -140,10 +140,10 @@ module Gitlab
def
find_diff_file
(
repository
)
def
find_diff_file
(
repository
)
# We're at the initial commit, so just get that as we can't compare to anything.
# We're at the initial commit, so just get that as we can't compare to anything.
if
Gitlab
::
Git
.
blank_ref?
(
start_sha
)
compare
=
if
Gitlab
::
Git
.
blank_ref?
(
start_sha
)
compare
=
Gitlab
::
Git
::
Commit
.
find
(
repository
.
raw_repository
,
head_sha
)
Gitlab
::
Git
::
Commit
.
find
(
repository
.
raw_repository
,
head_sha
)
else
else
compare
=
Gitlab
::
Git
::
Compare
.
new
(
Gitlab
::
Git
::
Compare
.
new
(
repository
.
raw_repository
,
repository
.
raw_repository
,
start_sha
,
start_sha
,
head_sha
head_sha
...
...
lib/gitlab/email/reply_parser.rb
View file @
8a4d68c5
...
@@ -31,10 +31,10 @@ module Gitlab
...
@@ -31,10 +31,10 @@ module Gitlab
private
private
def
select_body
(
message
)
def
select_body
(
message
)
if
message
.
multipart?
part
=
if
message
.
multipart?
part
=
message
.
text_part
||
message
.
html_part
||
message
message
.
text_part
||
message
.
html_part
||
message
else
else
part
=
message
message
end
end
decoded
=
fix_charset
(
part
)
decoded
=
fix_charset
(
part
)
...
...
lib/gitlab/metrics/instrumentation.rb
View file @
8a4d68c5
...
@@ -143,10 +143,10 @@ module Gitlab
...
@@ -143,10 +143,10 @@ module Gitlab
# signature this would break things. As a result we'll make sure the
# signature this would break things. As a result we'll make sure the
# generated method _only_ accepts regular arguments if the underlying
# generated method _only_ accepts regular arguments if the underlying
# method also accepts them.
# method also accepts them.
if
method
.
arity
==
0
args_signature
=
if
method
.
arity
==
0
args_signature
=
''
''
else
else
args_signature
=
'*args'
'*args'
end
end
proxy_module
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
proxy_module
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
...
...
lib/gitlab/saml/user.rb
View file @
8a4d68c5
...
@@ -28,10 +28,10 @@ module Gitlab
...
@@ -28,10 +28,10 @@ module Gitlab
if
external_users_enabled?
&&
@user
if
external_users_enabled?
&&
@user
# Check if there is overlap between the user's groups and the external groups
# Check if there is overlap between the user's groups and the external groups
# setting then set user as external or internal.
# setting then set user as external or internal.
if
(
auth_hash
.
groups
&
Gitlab
::
Saml
::
Config
.
external_groups
).
empty?
@user
.
external
=
if
(
auth_hash
.
groups
&
Gitlab
::
Saml
::
Config
.
external_groups
).
empty?
@user
.
external
=
false
false
else
else
@user
.
external
=
true
true
end
end
end
end
...
...
lib/gitlab/search_results.rb
View file @
8a4d68c5
...
@@ -56,10 +56,10 @@ module Gitlab
...
@@ -56,10 +56,10 @@ module Gitlab
def
issues
def
issues
issues
=
IssuesFinder
.
new
(
current_user
).
execute
.
where
(
project_id:
project_ids_relation
)
issues
=
IssuesFinder
.
new
(
current_user
).
execute
.
where
(
project_id:
project_ids_relation
)
if
query
=~
/#(\d+)\z/
i
ssues
=
i
f
query
=~
/#(\d+)\z/
issues
=
issues
.
where
(
iid:
$1
)
issues
.
where
(
iid:
$1
)
else
else
issues
=
issues
.
full_search
(
query
)
issues
.
full_search
(
query
)
end
end
issues
.
order
(
'updated_at DESC'
)
issues
.
order
(
'updated_at DESC'
)
...
@@ -73,10 +73,10 @@ module Gitlab
...
@@ -73,10 +73,10 @@ module Gitlab
def
merge_requests
def
merge_requests
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
).
execute
.
in_projects
(
project_ids_relation
)
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
).
execute
.
in_projects
(
project_ids_relation
)
if
query
=~
/[#!](\d+)\z/
merge_requests
=
if
query
=~
/[#!](\d+)\z/
merge_requests
=
merge_requests
.
where
(
iid:
$1
)
merge_requests
.
where
(
iid:
$1
)
else
else
merge_requests
=
merge_requests
.
full_search
(
query
)
merge_requests
.
full_search
(
query
)
end
end
merge_requests
.
order
(
'updated_at DESC'
)
merge_requests
.
order
(
'updated_at DESC'
)
end
end
...
...
lib/gitlab/sherlock/query.rb
View file @
8a4d68c5
...
@@ -94,10 +94,10 @@ module Gitlab
...
@@ -94,10 +94,10 @@ module Gitlab
private
private
def
raw_explain
(
query
)
def
raw_explain
(
query
)
if
Gitlab
::
Database
.
postgresql?
explain
=
if
Gitlab
::
Database
.
postgresql?
explain
=
"EXPLAIN ANALYZE
#{
query
}
;"
"EXPLAIN ANALYZE
#{
query
}
;"
else
else
explain
=
"EXPLAIN
#{
query
}
;"
"EXPLAIN
#{
query
}
;"
end
end
ActiveRecord
::
Base
.
connection
.
execute
(
explain
)
ActiveRecord
::
Base
.
connection
.
execute
(
explain
)
...
...
spec/features/issuables/issuable_list_spec.rb
View file @
8a4d68c5
...
@@ -47,10 +47,10 @@ describe 'issuable list', feature: true do
...
@@ -47,10 +47,10 @@ describe 'issuable list', feature: true do
def
create_issuables
(
issuable_type
)
def
create_issuables
(
issuable_type
)
3
.
times
do
3
.
times
do
if
issuable_type
==
:issue
i
ssuable
=
i
f
issuable_type
==
:issue
issuable
=
create
(
:issue
,
project:
project
,
author:
user
)
create
(
:issue
,
project:
project
,
author:
user
)
else
else
issuable
=
create
(
:merge_request
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
create
(
:merge_request
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
end
end
2
.
times
do
2
.
times
do
...
...
spec/support/issuables_list_metadata_shared_examples.rb
View file @
8a4d68c5
...
@@ -3,10 +3,10 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
...
@@ -3,10 +3,10 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
@issuable_ids
=
[]
@issuable_ids
=
[]
2
.
times
do
2
.
times
do
if
issuable_type
==
:issue
i
ssuable
=
i
f
issuable_type
==
:issue
issuable
=
create
(
issuable_type
,
project:
project
)
create
(
issuable_type
,
project:
project
)
else
else
issuable
=
create
(
issuable_type
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
create
(
issuable_type
,
title:
FFaker
::
Lorem
.
sentence
,
source_project:
project
,
source_branch:
FFaker
::
Name
.
name
)
end
end
@issuable_ids
<<
issuable
.
id
@issuable_ids
<<
issuable
.
id
...
...
spec/support/login_helpers.rb
View file @
8a4d68c5
...
@@ -15,10 +15,10 @@ module LoginHelpers
...
@@ -15,10 +15,10 @@ module LoginHelpers
# user = create(:user)
# user = create(:user)
# login_as(user)
# login_as(user)
def
login_as
(
user_or_role
)
def
login_as
(
user_or_role
)
if
user_or_role
.
kind_of?
(
User
)
@user
=
if
user_or_role
.
kind_of?
(
User
)
@user
=
user_or_role
user_or_role
else
else
@user
=
create
(
user_or_role
)
create
(
user_or_role
)
end
end
login_with
(
@user
)
login_with
(
@user
)
...
...
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