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
0568b90c
Commit
0568b90c
authored
Jun 10, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated issues_tracker and issues_tracker_id from project
parent
4a8ae77e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
12 additions
and
63 deletions
+12
-63
app/models/project.rb
app/models/project.rb
+0
-5
app/models/project_services/issue_tracker_service.rb
app/models/project_services/issue_tracker_service.rb
+3
-15
db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb
...remove_deprecated_issues_tracker_columns_from_projects.rb
+6
-0
db/schema.rb
db/schema.rb
+0
-2
spec/factories/projects.rb
spec/factories/projects.rb
+0
-6
spec/helpers/issues_helper_spec.rb
spec/helpers/issues_helper_spec.rb
+3
-13
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-22
No files found.
app/models/project.rb
View file @
0568b90c
...
...
@@ -146,7 +146,6 @@ class Project < ActiveRecord::Base
message:
Gitlab
::
Regex
.
project_path_regex_message
}
validates
:issues_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
inclusion:
{
in:
[
true
,
false
]
}
validates
:issues_tracker_id
,
length:
{
maximum:
255
},
allow_blank:
true
validates
:namespace
,
presence:
true
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
...
...
@@ -589,10 +588,6 @@ class Project < ActiveRecord::Base
update_column
(
:has_external_issue_tracker
,
services
.
external_issue_trackers
.
any?
)
end
def
can_have_issues_tracker_id?
self
.
issues_enabled
&&
!
self
.
default_issues_tracker?
end
def
build_missing_services
services_templates
=
Service
.
where
(
template:
true
)
...
...
app/models/project_services/issue_tracker_service.rb
View file @
0568b90c
...
...
@@ -38,9 +38,9 @@ class IssueTrackerService < Service
if
enabled_in_gitlab_config
self
.
properties
=
{
title:
issues_tracker
[
'title'
],
project_url:
add_issues_tracker_id
(
issues_tracker
[
'project_url'
])
,
issues_url:
add_issues_tracker_id
(
issues_tracker
[
'issues_url'
])
,
new_issue_url:
add_issues_tracker_id
(
issues_tracker
[
'new_issue_url'
])
project_url:
issues_tracker
[
'project_url'
]
,
issues_url:
issues_tracker
[
'issues_url'
]
,
new_issue_url:
issues_tracker
[
'new_issue_url'
]
}
else
self
.
properties
=
{}
...
...
@@ -83,16 +83,4 @@ class IssueTrackerService < Service
def
issues_tracker
Gitlab
.
config
.
issues_tracker
[
to_param
]
end
def
add_issues_tracker_id
(
url
)
if
self
.
project
id
=
self
.
project
.
issues_tracker_id
if
id
url
=
url
.
gsub
(
":issues_tracker_id"
,
id
)
end
end
url
end
end
db/migrate/20160610194713_remove_deprecated_issues_tracker_columns_from_projects.rb
0 → 100644
View file @
0568b90c
class
RemoveDeprecatedIssuesTrackerColumnsFromProjects
<
ActiveRecord
::
Migration
def
change
remove_column
:projects
,
:issues_tracker
,
:string
,
default:
'gitlab'
,
null:
false
remove_column
:projects
,
:issues_tracker_id
,
:string
end
end
db/schema.rb
View file @
0568b90c
...
...
@@ -751,8 +751,6 @@ ActiveRecord::Schema.define(version: 20160610301627) do
t
.
boolean
"merge_requests_enabled"
,
default:
true
,
null:
false
t
.
boolean
"wiki_enabled"
,
default:
true
,
null:
false
t
.
integer
"namespace_id"
t
.
string
"issues_tracker"
,
default:
"gitlab"
,
null:
false
t
.
string
"issues_tracker_id"
t
.
boolean
"snippets_enabled"
,
default:
true
,
null:
false
t
.
datetime
"last_activity_at"
t
.
string
"import_url"
...
...
spec/factories/projects.rb
View file @
0568b90c
...
...
@@ -67,9 +67,6 @@ FactoryGirl.define do
'new_issue_url'
=>
'http://redmine/projects/project_name_in_redmine/issues/new'
}
)
project
.
issues_tracker
=
'redmine'
project
.
issues_tracker_id
=
'project_name_in_redmine'
end
end
...
...
@@ -84,9 +81,6 @@ FactoryGirl.define do
'new_issue_url'
=>
'http://jira.example/secure/CreateIssue.jspa'
}
)
project
.
issues_tracker
=
'jira'
project
.
issues_tracker_id
=
'project_name_in_jira'
end
end
end
spec/helpers/issues_helper_spec.rb
View file @
0568b90c
...
...
@@ -7,10 +7,7 @@ describe IssuesHelper do
describe
"url_for_project_issues"
do
let
(
:project_url
)
{
ext_project
.
external_issue_tracker
.
project_url
}
let
(
:ext_expected
)
do
project_url
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
.
gsub
(
':issues_tracker_id'
,
ext_project
.
issues_tracker_id
.
to_s
)
end
let
(
:ext_expected
)
{
project_url
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
}
let
(
:int_expected
)
{
polymorphic_path
([
@project
.
namespace
,
project
])
}
it
"should return internal path if used internal tracker"
do
...
...
@@ -56,11 +53,7 @@ describe IssuesHelper do
describe
"url_for_issue"
do
let
(
:issues_url
)
{
ext_project
.
external_issue_tracker
.
issues_url
}
let
(
:ext_expected
)
do
issues_url
.
gsub
(
':id'
,
issue
.
iid
.
to_s
)
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
.
gsub
(
':issues_tracker_id'
,
ext_project
.
issues_tracker_id
.
to_s
)
end
let
(
:ext_expected
)
{
issues_url
.
gsub
(
':id'
,
issue
.
iid
.
to_s
).
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
}
let
(
:int_expected
)
{
polymorphic_path
([
@project
.
namespace
,
project
,
issue
])
}
it
"should return internal path if used internal tracker"
do
...
...
@@ -106,10 +99,7 @@ describe IssuesHelper do
describe
'url_for_new_issue'
do
let
(
:issues_url
)
{
ext_project
.
external_issue_tracker
.
new_issue_url
}
let
(
:ext_expected
)
do
issues_url
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
.
gsub
(
':issues_tracker_id'
,
ext_project
.
issues_tracker_id
.
to_s
)
end
let
(
:ext_expected
)
{
issues_url
.
gsub
(
':project_id'
,
ext_project
.
id
.
to_s
)
}
let
(
:int_expected
)
{
new_namespace_project_issue_path
(
project
.
namespace
,
project
)
}
it
"should return internal path if used internal tracker"
do
...
...
spec/models/project_spec.rb
View file @
0568b90c
...
...
@@ -53,7 +53,6 @@ describe Project, models: true do
it
{
is_expected
.
to
validate_length_of
(
:path
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_length_of
(
:description
).
is_within
(
0
..
2000
)
}
it
{
is_expected
.
to
validate_presence_of
(
:creator
)
}
it
{
is_expected
.
to
validate_length_of
(
:issues_tracker_id
).
is_within
(
0
..
255
)
}
it
{
is_expected
.
to
validate_presence_of
(
:namespace
)
}
it
'should not allow new projects beyond user limits'
do
...
...
@@ -321,27 +320,6 @@ describe Project, models: true do
end
end
describe
:can_have_issues_tracker_id?
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:ext_project
)
{
create
(
:redmine_project
)
}
it
'should be true for projects with external issues tracker if issues enabled'
do
expect
(
ext_project
.
can_have_issues_tracker_id?
).
to
be_truthy
end
it
'should be false for projects with internal issue tracker if issues enabled'
do
expect
(
project
.
can_have_issues_tracker_id?
).
to
be_falsey
end
it
'should be always false if issues disabled'
do
project
.
issues_enabled
=
false
ext_project
.
issues_enabled
=
false
expect
(
project
.
can_have_issues_tracker_id?
).
to
be_falsey
expect
(
ext_project
.
can_have_issues_tracker_id?
).
to
be_falsey
end
end
describe
:open_branches
do
let
(
:project
)
{
create
(
:project
)
}
...
...
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