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
48274581
Commit
48274581
authored
Mar 15, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate the review and update spec
The feature spec now also tests the absence of the new branch button
parent
2b97c921
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
21 deletions
+20
-21
CHANGELOG
CHANGELOG
+1
-1
app/models/issue.rb
app/models/issue.rb
+11
-11
app/services/system_note_service.rb
app/services/system_note_service.rb
+2
-2
spec/features/issues/new_branch_button_spec.rb
spec/features/issues/new_branch_button_spec.rb
+5
-6
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
48274581
...
...
@@ -4,6 +4,7 @@ v 8.6.0 (unreleased)
- Bump gitlab_git to 9.0.3 (Stan Hu)
- Support Golang subpackage fetching (Stan Hu)
- Bump Capybara gem to 2.6.2 (Stan Hu)
- New branch button appears on issues where applicable
- Contributions to forked projects are included in calendar
- Improve the formatting for the user page bio (Connor Shea)
- Removed the default password from the initial admin account created during
...
...
@@ -59,7 +60,6 @@ v 8.5.3
- Show commit message in JIRA mention comment
- Makes issue page and merge request page usable on mobile browsers.
- Improved UI for profile settings
- New branch button appears on issues where applicable
v 8.5.2
- Fix sidebar overlapping content when screen width was below 1200px
...
...
app/models/issue.rb
View file @
48274581
...
...
@@ -87,20 +87,20 @@ class Issue < ActiveRecord::Base
end
def
referenced_merge_requests
(
current_user
=
nil
)
if
defined?
(
@referenced_merge_requests
)
@referenced_merge_requests
[
current_user
]
||=
Gitlab
::
ReferenceExtractor
.
lazily
do
[
self
,
*
notes
].
flat_map
do
|
note
|
note
.
all_references
(
current_user
).
merge_requests
end
end
.
sort_by
(
&
:iid
).
uniq
else
@referenced_merge_requests
=
{}
referenced_merge_requests
(
current_user
)
@referenced_merge_requests
||=
{}
@referenced_merge_requests
[
current_user
]
||=
begin
Gitlab
::
ReferenceExtractor
.
lazily
do
[
self
,
*
notes
].
flat_map
do
|
note
|
note
.
all_references
(
current_user
).
merge_requests
end
end
.
sort_by
(
&
:iid
).
uniq
end
end
def
related_branches
self
.
project
.
repository
.
branch_names
.
select
{
|
branch
|
branch
.
start_with?
"
#{
iid
}
-"
}
self
.
project
.
repository
.
branch_names
.
select
do
|
branch
|
branch
=~
/\A
#{
iid
}
-(?!\d+-stable)/i
end
end
# Reset issue events cache
...
...
@@ -138,6 +138,6 @@ class Issue < ActiveRecord::Base
!
self
.
closed?
&&
!
self
.
project
.
forked?
&&
self
.
related_branches
.
empty?
&&
self
.
referenced
_merge_requests
(
current_user
).
empty?
self
.
closed_by
_merge_requests
(
current_user
).
empty?
end
end
app/services/system_note_service.rb
View file @
48274581
...
...
@@ -213,9 +213,9 @@ class SystemNoteService
# "Started branch `201-issue-branch-button`"
def
self
.
new_issue_branch
(
issue
,
project
,
author
,
branch
)
h
=
Gitlab
::
Application
.
routes
.
url_helpers
link
=
"
#{
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
}
"
link
=
h
.
namespace_project_compare_url
(
project
.
namespace
,
project
,
from:
project
.
default_branch
,
to:
branch
)
body
=
"Started branch [
#{
branch
}
](
#{
link
}
)"
body
=
"Started branch [
`
#{
branch
}
`
](
#{
link
}
)"
create_note
(
noteable:
issue
,
project:
project
,
author:
author
,
note:
body
)
end
...
...
spec/features/issues/new_branch_button_spec.rb
View file @
48274581
...
...
@@ -18,14 +18,13 @@ feature 'Start new branch from an issue', feature: true do
end
context
"when there is a referenced merge request"
do
let
(
:note
)
do
let
(
:note
)
do
create
(
:note
,
:on_issue
,
:system
,
project:
project
,
note:
"mentioned in !
#{
referenced_mr
.
iid
}
"
)
note:
"mentioned in !
#{
referenced_mr
.
iid
}
"
)
end
let
(
:referenced_mr
)
do
create
(
:merge_request
,
source_project:
project
,
target_project:
project
,
description:
"Fixes #
#{
issue
.
iid
}
"
)
let
(
:referenced_mr
)
do
create
(
:merge_request
,
:simple
,
source_project:
project
,
target_project:
project
,
description:
"Fixes #
#{
issue
.
iid
}
"
)
end
before
do
...
...
spec/services/system_note_service_spec.rb
View file @
48274581
...
...
@@ -287,7 +287,7 @@ describe SystemNoteService, services: true do
context
'when a branch is created from the new branch button'
do
it
'sets the note text'
do
expect
(
subject
.
note
).
to
eq
'Started branch 1-mepmep'
expect
(
subject
.
note
).
to
match
/\AStarted branch [`1-mepmep`]/
end
end
end
...
...
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