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
Jérome Perrin
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
Hide 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
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
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
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
validates
:url
,
url:
true
,
presence:
true
,
if: :activated?
validates
:api_url
,
url:
true
,
allow_blank:
true
...
...
app/services/chat_names/authorize_user_service.rb
View file @
c81928cf
module
ChatNames
class
AuthorizeUserService
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
def
initialize
(
service
,
params
)
@service
=
service
...
...
config/application.rb
View file @
c81928cf
...
...
@@ -166,9 +166,10 @@ module Gitlab
config
.
after_initialize
do
Rails
.
application
.
reload_routes!
named_routes_set
=
Gitlab
::
Application
.
routes
.
named_routes
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'
)
define_method
(
name
.
sub
(
'namespace_project'
,
'project'
))
do
|
project
,
*
args
|
...
...
@@ -177,14 +178,7 @@ module Gitlab
end
end
named_routes_set
.
url_helpers_module
.
include
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
Gitlab
::
Routing
.
add_helpers
(
project_url_helpers
)
end
end
end
lib/gitlab/badge/metadata.rb
View file @
c81928cf
...
...
@@ -4,7 +4,7 @@ module Gitlab
# Abstract class for badge metadata
#
class
Metadata
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
ActionView
::
Helpers
::
AssetTagHelper
include
ActionView
::
Helpers
::
UrlHelper
...
...
lib/gitlab/conflict/file.rb
View file @
c81928cf
module
Gitlab
module
Conflict
class
File
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
IconsHelper
MissingResolution
=
Class
.
new
(
ResolutionError
)
...
...
lib/gitlab/email/message/repository_push.rb
View file @
c81928cf
...
...
@@ -4,7 +4,7 @@ module Gitlab
class
RepositoryPush
attr_reader
:author_id
,
:ref
,
:action
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
DiffHelper
delegate
:namespace
,
:name_with_namespace
,
to: :project
,
prefix: :project
...
...
lib/gitlab/routing.rb
View file @
c81928cf
...
...
@@ -2,10 +2,30 @@ module Gitlab
module
Routing
extend
ActiveSupport
::
Concern
mattr_accessor
:_includers
self
.
_includers
=
[]
included
do
Gitlab
::
Routing
.
_includers
<<
self
include
Gitlab
::
Routing
.
url_helpers
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.
#
# 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
module
SlashCommands
module
Presenters
class
Base
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
def
initialize
(
resource
=
nil
)
@resource
=
resource
...
...
lib/gitlab/url_builder.rb
View file @
c81928cf
module
Gitlab
class
UrlBuilder
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
GitlabRoutingHelper
include
ActionView
::
RecordIdentifier
...
...
spec/lib/extracts_path_spec.rb
View file @
c81928cf
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
ExtractsPath
,
lib:
true
do
include
ExtractsPath
include
RepoHelpers
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
let
(
:project
)
{
double
(
'project'
)
}
let
(
:request
)
{
double
(
'request'
)
}
...
...
spec/models/project_services/jira_service_spec.rb
View file @
c81928cf
require
'spec_helper'
describe
JiraService
,
models:
true
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
describe
"Associations"
do
it
{
is_expected
.
to
belong_to
:project
}
...
...
spec/services/system_note_service_spec.rb
View file @
c81928cf
require
'spec_helper'
describe
SystemNoteService
,
services:
true
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:author
)
{
create
(
:user
)
}
...
...
spec/spec_helper.rb
View file @
c81928cf
...
...
@@ -57,7 +57,7 @@ RSpec.configure do |config|
config
.
include
StubGitlabCalls
config
.
include
StubGitlabData
config
.
include
ApiHelpers
,
:api
config
.
include
Gitlab
::
Routing
.
url_helpers
,
type: :routing
config
.
include
Gitlab
::
Routing
,
type: :routing
config
.
include
MigrationsHelpers
,
:migration
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