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
Tatuya Kamada
gitlab-ce
Commits
65e70047
Commit
65e70047
authored
Jan 26, 2015
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the issue tracker attribute on issue tracker change.
parent
c70dcd29
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
13 deletions
+15
-13
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+3
-0
app/helpers/issues_helper.rb
app/helpers/issues_helper.rb
+3
-3
app/models/project.rb
app/models/project.rb
+8
-9
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+1
-1
No files found.
app/controllers/projects/services_controller.rb
View file @
65e70047
...
@@ -17,6 +17,9 @@ class Projects::ServicesController < Projects::ApplicationController
...
@@ -17,6 +17,9 @@ class Projects::ServicesController < Projects::ApplicationController
def
update
def
update
if
@service
.
update_attributes
(
service_params
)
if
@service
.
update_attributes
(
service_params
)
if
@service
.
activated?
&&
@service
.
category
==
:issue_tracker
@project
.
update_attributes
(
issues_tracker:
@service
.
to_param
)
end
redirect_to
edit_project_service_path
(
@project
,
@service
.
to_param
),
redirect_to
edit_project_service_path
(
@project
,
@service
.
to_param
),
notice:
'Successfully updated.'
notice:
'Successfully updated.'
else
else
...
...
app/helpers/issues_helper.rb
View file @
65e70047
...
@@ -16,7 +16,7 @@ module IssuesHelper
...
@@ -16,7 +16,7 @@ module IssuesHelper
def
url_for_project_issues
(
project
=
@project
)
def
url_for_project_issues
(
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
using_issue
_tracker?
if
project
.
default_issues
_tracker?
project_issues_path
(
project
)
project_issues_path
(
project
)
else
else
project
.
external_issue_tracker
.
project_url
project
.
external_issue_tracker
.
project_url
...
@@ -26,7 +26,7 @@ module IssuesHelper
...
@@ -26,7 +26,7 @@ module IssuesHelper
def
url_for_new_issue
(
project
=
@project
)
def
url_for_new_issue
(
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
using_issue
_tracker?
if
project
.
default_issues
_tracker?
url
=
new_project_issue_path
project_id:
project
url
=
new_project_issue_path
project_id:
project
else
else
project
.
external_issue_tracker
.
new_issue_url
project
.
external_issue_tracker
.
new_issue_url
...
@@ -36,7 +36,7 @@ module IssuesHelper
...
@@ -36,7 +36,7 @@ module IssuesHelper
def
url_for_issue
(
issue_iid
,
project
=
@project
)
def
url_for_issue
(
issue_iid
,
project
=
@project
)
return
''
if
project
.
nil?
return
''
if
project
.
nil?
if
project
.
using_issue
_tracker?
if
project
.
default_issues
_tracker?
url
=
project_issue_url
project_id:
project
,
id:
issue_iid
url
=
project_issue_url
project_id:
project
,
id:
issue_iid
else
else
url
=
project
.
external_issue_tracker
.
issues_url
url
=
project
.
external_issue_tracker
.
issues_url
...
...
app/models/project.rb
View file @
65e70047
...
@@ -308,11 +308,14 @@ class Project < ActiveRecord::Base
...
@@ -308,11 +308,14 @@ class Project < ActiveRecord::Base
end
end
def
default_issues_tracker?
def
default_issues_tracker?
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
if
external_issue_tracker
false
else
unless
self
.
issues_tracker
==
Project
.
issues_tracker
.
default_value
self
.
update_attributes
(
issues_tracker:
Project
.
issues_tracker
.
default_value
)
end
true
end
end
def
external_issues_tracker_enabled?
external_issues_trackers
.
any?
end
end
def
external_issues_trackers
def
external_issues_trackers
...
@@ -323,10 +326,6 @@ class Project < ActiveRecord::Base
...
@@ -323,10 +326,6 @@ class Project < ActiveRecord::Base
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
@external_issues_tracker
||=
external_issues_trackers
.
select
(
&
:activated?
).
first
end
end
def
using_issue_tracker?
default_issues_tracker?
||
!
external_issues_tracker_enabled?
end
def
can_have_issues_tracker_id?
def
can_have_issues_tracker_id?
self
.
issues_enabled
&&
!
self
.
default_issues_tracker?
self
.
issues_enabled
&&
!
self
.
default_issues_tracker?
end
end
...
...
lib/gitlab/markdown.rb
View file @
65e70047
...
@@ -208,7 +208,7 @@ module Gitlab
...
@@ -208,7 +208,7 @@ module Gitlab
end
end
def
reference_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
def
reference_issue
(
identifier
,
project
=
@project
,
prefix_text
=
nil
)
if
project
.
using_issue
_tracker?
if
project
.
default_issues
_tracker?
if
project
.
issue_exists?
identifier
if
project
.
issue_exists?
identifier
url
=
url_for_issue
(
identifier
,
project
)
url
=
url_for_issue
(
identifier
,
project
)
title
=
title_for_issue
(
identifier
,
project
)
title
=
title_for_issue
(
identifier
,
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