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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c81928cf
Commit
c81928cf
authored
Jul 07, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include new URL helpers retroactively into includers of Gitlab::Routing
parent
1dab6403
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
36 additions
and
22 deletions
+36
-22
app/models/project_services/gitlab_issue_tracker_service.rb
app/models/project_services/gitlab_issue_tracker_service.rb
+1
-1
app/models/project_services/jira_service.rb
app/models/project_services/jira_service.rb
+1
-1
app/services/chat_names/authorize_user_service.rb
app/services/chat_names/authorize_user_service.rb
+1
-1
config/application.rb
config/application.rb
+4
-10
lib/gitlab/badge/metadata.rb
lib/gitlab/badge/metadata.rb
+1
-1
lib/gitlab/conflict/file.rb
lib/gitlab/conflict/file.rb
+1
-1
lib/gitlab/email/message/repository_push.rb
lib/gitlab/email/message/repository_push.rb
+1
-1
lib/gitlab/routing.rb
lib/gitlab/routing.rb
+20
-0
lib/gitlab/slash_commands/presenters/base.rb
lib/gitlab/slash_commands/presenters/base.rb
+1
-1
lib/gitlab/url_builder.rb
lib/gitlab/url_builder.rb
+1
-1
spec/lib/extracts_path_spec.rb
spec/lib/extracts_path_spec.rb
+1
-1
spec/models/project_services/jira_service_spec.rb
spec/models/project_services/jira_service_spec.rb
+1
-1
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+1
-1
spec/spec_helper.rb
spec/spec_helper.rb
+1
-1
No files found.
app/models/project_services/gitlab_issue_tracker_service.rb
View file @
c81928cf
class
GitlabIssueTrackerService
<
IssueTrackerService
class
GitlabIssueTrackerService
<
IssueTrackerService
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
validates
:project_url
,
:issues_url
,
:new_issue_url
,
presence:
true
,
url:
true
,
if: :activated?
validates
:project_url
,
:issues_url
,
:new_issue_url
,
presence:
true
,
url:
true
,
if: :activated?
...
...
app/models/project_services/jira_service.rb
View file @
c81928cf
class
JiraService
<
IssueTrackerService
class
JiraService
<
IssueTrackerService
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
validates
:url
,
url:
true
,
presence:
true
,
if: :activated?
validates
:url
,
url:
true
,
presence:
true
,
if: :activated?
validates
:api_url
,
url:
true
,
allow_blank:
true
validates
:api_url
,
url:
true
,
allow_blank:
true
...
...
app/services/chat_names/authorize_user_service.rb
View file @
c81928cf
module
ChatNames
module
ChatNames
class
AuthorizeUserService
class
AuthorizeUserService
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
def
initialize
(
service
,
params
)
def
initialize
(
service
,
params
)
@service
=
service
@service
=
service
...
...
config/application.rb
View file @
c81928cf
...
@@ -166,9 +166,10 @@ module Gitlab
...
@@ -166,9 +166,10 @@ module Gitlab
config
.
after_initialize
do
config
.
after_initialize
do
Rails
.
application
.
reload_routes!
Rails
.
application
.
reload_routes!
named_routes_set
=
Gitlab
::
Application
.
routes
.
named_routes
project_url_helpers
=
Module
.
new
do
project_url_helpers
=
Module
.
new
do
named_routes_set
.
helper_names
.
each
do
|
name
|
extend
ActiveSupport
::
Concern
Gitlab
::
Application
.
routes
.
named_routes
.
helper_names
.
each
do
|
name
|
next
unless
name
.
include?
(
'namespace_project'
)
next
unless
name
.
include?
(
'namespace_project'
)
define_method
(
name
.
sub
(
'namespace_project'
,
'project'
))
do
|
project
,
*
args
|
define_method
(
name
.
sub
(
'namespace_project'
,
'project'
))
do
|
project
,
*
args
|
...
@@ -177,14 +178,7 @@ module Gitlab
...
@@ -177,14 +178,7 @@ module Gitlab
end
end
end
end
named_routes_set
.
url_helpers_module
.
include
project_url_helpers
Gitlab
::
Routing
.
add_helpers
(
project_url_helpers
)
named_routes_set
.
url_helpers_module
.
extend
project_url_helpers
Gitlab
::
Routing
.
url_helpers
.
include
project_url_helpers
Gitlab
::
Routing
.
url_helpers
.
extend
project_url_helpers
GitlabRoutingHelper
.
include
project_url_helpers
GitlabRoutingHelper
.
extend
project_url_helpers
end
end
end
end
end
end
lib/gitlab/badge/metadata.rb
View file @
c81928cf
...
@@ -4,7 +4,7 @@ module Gitlab
...
@@ -4,7 +4,7 @@ module Gitlab
# Abstract class for badge metadata
# Abstract class for badge metadata
#
#
class
Metadata
class
Metadata
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
ActionView
::
Helpers
::
AssetTagHelper
include
ActionView
::
Helpers
::
AssetTagHelper
include
ActionView
::
Helpers
::
UrlHelper
include
ActionView
::
Helpers
::
UrlHelper
...
...
lib/gitlab/conflict/file.rb
View file @
c81928cf
module
Gitlab
module
Gitlab
module
Conflict
module
Conflict
class
File
class
File
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
IconsHelper
include
IconsHelper
MissingResolution
=
Class
.
new
(
ResolutionError
)
MissingResolution
=
Class
.
new
(
ResolutionError
)
...
...
lib/gitlab/email/message/repository_push.rb
View file @
c81928cf
...
@@ -4,7 +4,7 @@ module Gitlab
...
@@ -4,7 +4,7 @@ module Gitlab
class
RepositoryPush
class
RepositoryPush
attr_reader
:author_id
,
:ref
,
:action
attr_reader
:author_id
,
:ref
,
:action
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
DiffHelper
include
DiffHelper
delegate
:namespace
,
:name_with_namespace
,
to: :project
,
prefix: :project
delegate
:namespace
,
:name_with_namespace
,
to: :project
,
prefix: :project
...
...
lib/gitlab/routing.rb
View file @
c81928cf
...
@@ -2,10 +2,30 @@ module Gitlab
...
@@ -2,10 +2,30 @@ module Gitlab
module
Routing
module
Routing
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
mattr_accessor
:_includers
self
.
_includers
=
[]
included
do
included
do
Gitlab
::
Routing
.
_includers
<<
self
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
.
url_helpers
end
end
def
self
.
add_helpers
(
mod
)
url_helpers
.
include
mod
url_helpers
.
extend
mod
app_url_helpers
=
Gitlab
::
Application
.
routes
.
named_routes
.
url_helpers_module
app_url_helpers
.
include
mod
app_url_helpers
.
extend
mod
GitlabRoutingHelper
.
include
mod
GitlabRoutingHelper
.
extend
mod
_includers
.
each
do
|
klass
|
klass
.
include
mod
end
end
# Returns the URL helpers Module.
# Returns the URL helpers Module.
#
#
# This method caches the output as Rails' "url_helpers" method creates an
# This method caches the output as Rails' "url_helpers" method creates an
...
...
lib/gitlab/slash_commands/presenters/base.rb
View file @
c81928cf
...
@@ -2,7 +2,7 @@ module Gitlab
...
@@ -2,7 +2,7 @@ module Gitlab
module
SlashCommands
module
SlashCommands
module
Presenters
module
Presenters
class
Base
class
Base
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
def
initialize
(
resource
=
nil
)
def
initialize
(
resource
=
nil
)
@resource
=
resource
@resource
=
resource
...
...
lib/gitlab/url_builder.rb
View file @
c81928cf
module
Gitlab
module
Gitlab
class
UrlBuilder
class
UrlBuilder
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
GitlabRoutingHelper
include
GitlabRoutingHelper
include
ActionView
::
RecordIdentifier
include
ActionView
::
RecordIdentifier
...
...
spec/lib/extracts_path_spec.rb
View file @
c81928cf
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
ExtractsPath
,
lib:
true
do
describe
ExtractsPath
,
lib:
true
do
include
ExtractsPath
include
ExtractsPath
include
RepoHelpers
include
RepoHelpers
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
let
(
:project
)
{
double
(
'project'
)
}
let
(
:project
)
{
double
(
'project'
)
}
let
(
:request
)
{
double
(
'request'
)
}
let
(
:request
)
{
double
(
'request'
)
}
...
...
spec/models/project_services/jira_service_spec.rb
View file @
c81928cf
require
'spec_helper'
require
'spec_helper'
describe
JiraService
,
models:
true
do
describe
JiraService
,
models:
true
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
describe
"Associations"
do
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
:project
}
it
{
is_expected
.
to
belong_to
:project
}
...
...
spec/services/system_note_service_spec.rb
View file @
c81928cf
require
'spec_helper'
require
'spec_helper'
describe
SystemNoteService
,
services:
true
do
describe
SystemNoteService
,
services:
true
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:author
)
{
create
(
:user
)
}
let
(
:author
)
{
create
(
:user
)
}
...
...
spec/spec_helper.rb
View file @
c81928cf
...
@@ -57,7 +57,7 @@ RSpec.configure do |config|
...
@@ -57,7 +57,7 @@ RSpec.configure do |config|
config
.
include
StubGitlabCalls
config
.
include
StubGitlabCalls
config
.
include
StubGitlabData
config
.
include
StubGitlabData
config
.
include
ApiHelpers
,
:api
config
.
include
ApiHelpers
,
:api
config
.
include
Gitlab
::
Routing
.
url_helpers
,
type: :routing
config
.
include
Gitlab
::
Routing
,
type: :routing
config
.
include
MigrationsHelpers
,
:migration
config
.
include
MigrationsHelpers
,
:migration
config
.
infer_spec_type_from_file_location!
config
.
infer_spec_type_from_file_location!
...
...
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