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
d4efdaaf
Commit
d4efdaaf
authored
Feb 17, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into ce_upstream
parents
e405b8f3
b4e72516
Changes
33
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
567 additions
and
221 deletions
+567
-221
CHANGELOG
CHANGELOG
+6
-0
app/assets/stylesheets/pages/issuable.scss
app/assets/stylesheets/pages/issuable.scss
+25
-0
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+1
-1
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+2
-2
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-70
app/helpers/issuables_helper.rb
app/helpers/issuables_helper.rb
+37
-0
app/helpers/nav_helper.rb
app/helpers/nav_helper.rb
+3
-15
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+4
-7
app/models/project.rb
app/models/project.rb
+13
-4
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+1
-1
app/models/project_wiki.rb
app/models/project_wiki.rb
+1
-1
app/models/repository.rb
app/models/repository.rb
+1
-1
app/services/system_note_service.rb
app/services/system_note_service.rb
+14
-5
app/views/projects/diffs/_image.html.haml
app/views/projects/diffs/_image.html.haml
+2
-0
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+7
-10
doc/ci/variables/README.md
doc/ci/variables/README.md
+1
-1
doc/install/installation.md
doc/install/installation.md
+10
-15
doc/install/redis.md
doc/install/redis.md
+60
-0
doc/web_hooks/web_hooks.md
doc/web_hooks/web_hooks.md
+196
-44
features/project/issues/issues.feature
features/project/issues/issues.feature
+8
-1
features/project/merge_requests.feature
features/project/merge_requests.feature
+1
-0
features/steps/project/issues/award_emoji.rb
features/steps/project/issues/award_emoji.rb
+2
-0
features/steps/project/issues/issues.rb
features/steps/project/issues/issues.rb
+5
-0
features/steps/shared/issuable.rb
features/steps/shared/issuable.rb
+24
-0
lib/gitlab/note_data_builder.rb
lib/gitlab/note_data_builder.rb
+4
-7
lib/gitlab/push_data_builder.rb
lib/gitlab/push_data_builder.rb
+6
-10
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+37
-0
spec/lib/gitlab/note_data_builder_spec.rb
spec/lib/gitlab/note_data_builder_spec.rb
+24
-6
spec/lib/gitlab/push_data_builder_spec.rb
spec/lib/gitlab/push_data_builder_spec.rb
+3
-3
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+12
-11
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+15
-6
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+15
-0
spec/support/project_hook_data_shared_example.rb
spec/support/project_hook_data_shared_example.rb
+27
-0
No files found.
CHANGELOG
View file @
d4efdaaf
...
@@ -35,6 +35,11 @@ v 8.5.0 (unreleased)
...
@@ -35,6 +35,11 @@ v 8.5.0 (unreleased)
- Update the ExternalIssue regex pattern (Blake Hitchcock)
- Update the ExternalIssue regex pattern (Blake Hitchcock)
- Remember user's inline/side-by-side diff view preference in a cookie (Kirill Katsnelson)
- Remember user's inline/side-by-side diff view preference in a cookie (Kirill Katsnelson)
- Optimized performance of finding issues to be closed by a merge request
- Optimized performance of finding issues to be closed by a merge request
- Add `avatar_url`, `description`, `git_ssh_url`, `git_http_url`, `path_with_namespace`
and `default_branch` in `project` in push, issue, merge-request and note webhooks data (Kirill Zaitsev)
- Deprecate the `ssh_url` in favor of `git_ssh_url` and `http_url` in favor of `git_http_url`
in `project` for push, issue, merge-request and note webhooks data (Kirill Zaitsev)
- Deprecate the `repository` key in push, issue, merge-request and note webhooks data, use `project` instead (Kirill Zaitsev)
- API: Expose MergeRequest#merge_status (Andrei Dziahel)
- API: Expose MergeRequest#merge_status (Andrei Dziahel)
- Revert "Add IP check against DNSBLs at account sign-up"
- Revert "Add IP check against DNSBLs at account sign-up"
- Actually use the `skip_merges` option in Repository#commits (Tony Chu)
- Actually use the `skip_merges` option in Repository#commits (Tony Chu)
...
@@ -50,6 +55,7 @@ v 8.5.0 (unreleased)
...
@@ -50,6 +55,7 @@ v 8.5.0 (unreleased)
- Fixed logo animation on Safari (Roman Rott)
- Fixed logo animation on Safari (Roman Rott)
- Hide remove source branch button when the MR is merged but new commits are pushed (Zeger-Jan van de Weg)
- Hide remove source branch button when the MR is merged but new commits are pushed (Zeger-Jan van de Weg)
- In seach autocomplete show only groups and projects you are member of
- In seach autocomplete show only groups and projects you are member of
- Don't process cross-reference notes from forks
- Fix: init.d script not working on OS X
- Fix: init.d script not working on OS X
- Faster snippet search
- Faster snippet search
- Title for milestones should be unique (Zeger-Jan van de Weg)
- Title for milestones should be unique (Zeger-Jan van de Weg)
...
...
app/assets/stylesheets/pages/issuable.scss
View file @
d4efdaaf
...
@@ -80,6 +80,10 @@
...
@@ -80,6 +80,10 @@
display
:
inline-block
;
display
:
inline-block
;
}
}
.select2-container
span
{
margin-top
:
0
;
}
.issuable-count
{
.issuable-count
{
}
}
...
@@ -88,6 +92,10 @@
...
@@ -88,6 +92,10 @@
margin-left
:
20px
;
margin-left
:
20px
;
border-left
:
1px
solid
$border-gray-light
;
border-left
:
1px
solid
$border-gray-light
;
padding-left
:
10px
;
padding-left
:
10px
;
&
:hover
{
color
:
$gray-darkest
;
}
}
}
}
}
...
@@ -192,6 +200,10 @@
...
@@ -192,6 +200,10 @@
.btn
{
.btn
{
background
:
$gray-normal
;
background
:
$gray-normal
;
border
:
1px
solid
$border-gray-normal
;
border
:
1px
solid
$border-gray-normal
;
&
:hover
{
background
:
$gray-dark
;
border
:
1px
solid
$border-gray-dark
;
}
}
}
&
.right-sidebar-collapsed
{
&
.right-sidebar-collapsed
{
...
@@ -223,6 +235,19 @@
...
@@ -223,6 +235,19 @@
display
:
block
;
display
:
block
;
margin-top
:
0
;
margin-top
:
0
;
}
}
.btn-clipboard
{
border
:
none
;
&
:hover
{
background
:
transparent
;
}
i
{
color
:
#999999
;
}
}
}
}
}
}
...
...
app/controllers/application_controller.rb
View file @
d4efdaaf
...
@@ -168,7 +168,7 @@ class ApplicationController < ActionController::Base
...
@@ -168,7 +168,7 @@ class ApplicationController < ActionController::Base
end
end
def
git_not_found!
def
git_not_found!
render
html:
"errors/git_not_found
"
,
layout:
"errors"
,
status:
404
render
"errors/git_not_found.html
"
,
layout:
"errors"
,
status:
404
end
end
def
method_missing
(
method_sym
,
*
arguments
,
&
block
)
def
method_missing
(
method_sym
,
*
arguments
,
&
block
)
...
...
app/controllers/projects/commit_controller.rb
View file @
d4efdaaf
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -11,8 +11,6 @@ class Projects::CommitController < Projects::ApplicationController
before_action
:define_show_vars
,
only:
[
:show
,
:builds
]
before_action
:define_show_vars
,
only:
[
:show
,
:builds
]
def
show
def
show
return
git_not_found!
unless
@commit
apply_diff_view_cookie!
apply_diff_view_cookie!
@line_notes
=
commit
.
notes
.
inline
@line_notes
=
commit
.
notes
.
inline
...
@@ -68,6 +66,8 @@ class Projects::CommitController < Projects::ApplicationController
...
@@ -68,6 +66,8 @@ class Projects::CommitController < Projects::ApplicationController
end
end
def
define_show_vars
def
define_show_vars
return
git_not_found!
unless
commit
if
params
[
:w
].
to_i
==
1
if
params
[
:w
].
to_i
==
1
@diffs
=
commit
.
diffs
({
ignore_whitespace_change:
true
})
@diffs
=
commit
.
diffs
({
ignore_whitespace_change:
true
})
else
else
...
...
app/helpers/application_helper.rb
View file @
d4efdaaf
...
@@ -283,76 +283,6 @@ module ApplicationHelper
...
@@ -283,76 +283,6 @@ module ApplicationHelper
end
end
end
end
def
issuable_link_next
(
project
,
issuable
)
if
project
.
nil?
nil
elsif
current_controller?
(
:issues
)
namespace_project_issue_path
(
project
.
namespace
,
project
,
next_issuable_for
(
project
,
issuable
.
id
).
try
(
:iid
))
elsif
current_controller?
(
:merge_requests
)
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
next_issuable_for
(
project
,
issuable
.
id
).
try
(
:iid
))
end
end
def
issuable_link_prev
(
project
,
issuable
)
if
project
.
nil?
nil
elsif
current_controller?
(
:issues
)
namespace_project_issue_path
(
project
.
namespace
,
project
,
prev_issuable_for
(
project
,
issuable
.
id
).
try
(
:iid
))
elsif
current_controller?
(
:merge_requests
)
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
prev_issuable_for
(
project
,
issuable
.
id
).
try
(
:iid
))
end
end
def
issuable_count
(
entity
,
project
)
if
project
.
nil?
0
elsif
current_controller?
(
:issues
)
project
.
issues
.
send
(
entity
).
count
elsif
current_controller?
(
:merge_requests
)
project
.
merge_requests
.
send
(
entity
).
count
end
end
def
next_issuable_for
(
project
,
id
)
if
project
.
nil?
nil
elsif
current_controller?
(
:issues
)
project
.
issues
.
where
(
"id > ?"
,
id
).
last
elsif
current_controller?
(
:merge_requests
)
project
.
merge_requests
.
where
(
"id > ?"
,
id
).
last
end
end
def
has_next_issuable?
(
project
,
id
)
if
project
.
nil?
nil
elsif
current_controller?
(
:issues
)
project
.
issues
.
where
(
"id > ?"
,
id
).
last
elsif
current_controller?
(
:merge_requests
)
project
.
merge_requests
.
where
(
"id > ?"
,
id
).
last
end
end
def
prev_issuable_for
(
project
,
id
)
if
project
.
nil?
nil
elsif
current_controller?
(
:issues
)
project
.
issues
.
where
(
"id < ?"
,
id
).
first
elsif
current_controller?
(
:merge_requests
)
project
.
merge_requests
.
where
(
"id < ?"
,
id
).
first
end
end
def
has_prev_issuable?
(
project
,
id
)
if
project
.
nil?
nil
elsif
current_controller?
(
:issues
)
project
.
issues
.
where
(
"id < ?"
,
id
).
first
elsif
current_controller?
(
:merge_requests
)
project
.
merge_requests
.
where
(
"id < ?"
,
id
).
first
end
end
def
state_filters_text_for
(
entity
,
project
)
def
state_filters_text_for
(
entity
,
project
)
titles
=
{
titles
=
{
opened:
"Open"
opened:
"Open"
...
...
app/helpers/issuables_helper.rb
0 → 100644
View file @
d4efdaaf
module
IssuablesHelper
def
sidebar_gutter_toggle_icon
sidebar_gutter_collapsed?
?
icon
(
'angle-double-left'
)
:
icon
(
'angle-double-right'
)
end
def
sidebar_gutter_collapsed_class
"right-sidebar-
#{
sidebar_gutter_collapsed?
?
'collapsed'
:
'expanded'
}
"
end
def
issuables_count
(
issuable
)
base_issuable_scope
(
issuable
).
maximum
(
:iid
)
end
def
next_issuable_for
(
issuable
)
base_issuable_scope
(
issuable
).
where
(
'iid > ?'
,
issuable
.
iid
).
last
end
def
prev_issuable_for
(
issuable
)
base_issuable_scope
(
issuable
).
where
(
'iid < ?'
,
issuable
.
iid
).
first
end
private
def
sidebar_gutter_collapsed?
cookies
[
:collapsed_gutter
]
==
'true'
end
def
base_issuable_scope
(
issuable
)
issuable
.
project
.
send
(
issuable
.
class
.
table_name
).
send
(
issuable_state_scope
(
issuable
))
end
def
issuable_state_scope
(
issuable
)
issuable
.
open?
?
:opened
:
:closed
end
end
app/helpers/nav_helper.rb
View file @
d4efdaaf
...
@@ -3,18 +3,6 @@ module NavHelper
...
@@ -3,18 +3,6 @@ module NavHelper
cookies
[
:collapsed_nav
]
==
'true'
cookies
[
:collapsed_nav
]
==
'true'
end
end
def
sidebar_gutter_collapsed_class
if
cookies
[
:collapsed_gutter
]
==
'true'
"right-sidebar-collapsed"
else
"right-sidebar-expanded"
end
end
def
sidebar_gutter_collapsed?
cookies
[
:collapsed_gutter
]
==
'true'
end
def
nav_sidebar_class
def
nav_sidebar_class
if
nav_menu_collapsed?
if
nav_menu_collapsed?
"sidebar-collapsed"
"sidebar-collapsed"
...
@@ -32,9 +20,9 @@ module NavHelper
...
@@ -32,9 +20,9 @@ module NavHelper
end
end
def
page_gutter_class
def
page_gutter_class
if
current_path?
(
'merge_requests#show'
)
||
if
current_path?
(
'merge_requests#show'
)
||
current_path?
(
'merge_requests#diffs'
)
||
current_path?
(
'merge_requests#diffs'
)
||
current_path?
(
'merge_requests#commits'
)
||
current_path?
(
'merge_requests#commits'
)
||
current_path?
(
'issues#show'
)
current_path?
(
'issues#show'
)
if
cookies
[
:collapsed_gutter
]
==
'true'
if
cookies
[
:collapsed_gutter
]
==
'true'
"page-gutter right-sidebar-collapsed"
"page-gutter right-sidebar-collapsed"
...
...
app/models/concerns/issuable.rb
View file @
d4efdaaf
...
@@ -129,13 +129,10 @@ module Issuable
...
@@ -129,13 +129,10 @@ module Issuable
hook_data
=
{
hook_data
=
{
object_kind:
self
.
class
.
name
.
underscore
,
object_kind:
self
.
class
.
name
.
underscore
,
user:
user
.
hook_attrs
,
user:
user
.
hook_attrs
,
repository:
{
project:
project
.
hook_attrs
,
name:
project
.
name
,
object_attributes:
hook_attrs
,
url:
project
.
url_to_repo
,
# DEPRECATED
description:
project
.
description
,
repository:
project
.
hook_attrs
.
slice
(
:name
,
:url
,
:description
,
:homepage
)
homepage:
project
.
web_url
},
object_attributes:
hook_attrs
}
}
hook_data
.
merge!
(
assignee:
assignee
.
hook_attrs
)
if
assignee
hook_data
.
merge!
(
assignee:
assignee
.
hook_attrs
)
if
assignee
...
...
app/models/project.rb
View file @
d4efdaaf
...
@@ -377,7 +377,7 @@ class Project < ActiveRecord::Base
...
@@ -377,7 +377,7 @@ class Project < ActiveRecord::Base
end
end
def
repository
def
repository
@repository
||=
Repository
.
new
(
path_with_namespace
,
nil
,
self
)
@repository
||=
Repository
.
new
(
path_with_namespace
,
self
)
end
end
def
commit
(
id
=
'HEAD'
)
def
commit
(
id
=
'HEAD'
)
...
@@ -844,11 +844,20 @@ class Project < ActiveRecord::Base
...
@@ -844,11 +844,20 @@ class Project < ActiveRecord::Base
def
hook_attrs
def
hook_attrs
{
{
name:
name
,
name:
name
,
ssh_url:
ssh_url_to_repo
,
description:
description
,
http_url:
http_url_to_repo
,
web_url:
web_url
,
web_url:
web_url
,
avatar_url:
avatar_url
,
git_ssh_url:
ssh_url_to_repo
,
git_http_url:
http_url_to_repo
,
namespace:
namespace
.
name
,
namespace:
namespace
.
name
,
visibility_level:
visibility_level
visibility_level:
visibility_level
,
path_with_namespace:
path_with_namespace
,
default_branch:
default_branch
,
# Backward compatibility
homepage:
web_url
,
url:
url_to_repo
,
ssh_url:
ssh_url_to_repo
,
http_url:
http_url_to_repo
}
}
end
end
...
...
app/models/project_services/pushover_service.rb
View file @
d4efdaaf
...
@@ -112,7 +112,7 @@ class PushoverService < Service
...
@@ -112,7 +112,7 @@ class PushoverService < Service
priority:
priority
,
priority:
priority
,
title:
"
#{
project
.
name_with_namespace
}
"
,
title:
"
#{
project
.
name_with_namespace
}
"
,
message:
message
,
message:
message
,
url:
data
[
:
repository
][
:homepage
],
url:
data
[
:
project
][
:web_url
],
url_title:
"See project
#{
project
.
name_with_namespace
}
"
url_title:
"See project
#{
project
.
name_with_namespace
}
"
}
}
...
...
app/models/project_wiki.rb
View file @
d4efdaaf
...
@@ -131,7 +131,7 @@ class ProjectWiki
...
@@ -131,7 +131,7 @@ class ProjectWiki
end
end
def
repository
def
repository
Repository
.
new
(
path_with_namespace
,
default_branch
,
@project
)
Repository
.
new
(
path_with_namespace
,
@project
)
end
end
def
default_branch
def
default_branch
...
...
app/models/repository.rb
View file @
d4efdaaf
...
@@ -19,7 +19,7 @@ class Repository
...
@@ -19,7 +19,7 @@ class Repository
Gitlab
::
Popen
.
popen
(
%W(find
#{
repository_downloads_path
}
-not -path
#{
repository_downloads_path
}
-mmin +120 -delete)
)
Gitlab
::
Popen
.
popen
(
%W(find
#{
repository_downloads_path
}
-not -path
#{
repository_downloads_path
}
-mmin +120 -delete)
)
end
end
def
initialize
(
path_with_namespace
,
default_branch
=
nil
,
project
=
nil
)
def
initialize
(
path_with_namespace
,
project
)
@path_with_namespace
=
path_with_namespace
@path_with_namespace
=
path_with_namespace
@project
=
project
@project
=
project
end
end
...
...
app/services/system_note_service.rb
View file @
d4efdaaf
...
@@ -274,12 +274,15 @@ class SystemNoteService
...
@@ -274,12 +274,15 @@ class SystemNoteService
# Check if a cross reference to a noteable from a mentioner already exists
# Check if a cross reference to a noteable from a mentioner already exists
#
#
# This method is used to prevent multiple notes being created for a mention
# This method is used to prevent multiple notes being created for a mention
# when a issue is updated, for example.
# when a issue is updated, for example. The method also calls notes_for_mentioner
# to check if the mentioner is a commit, and return matches only on commit hash
# instead of project + commit, to avoid repeated mentions from forks.
#
#
# noteable - Noteable object being referenced
# noteable - Noteable object being referenced
# mentioner - Mentionable object
# mentioner - Mentionable object
#
#
# Returns Boolean
# Returns Boolean
def
self
.
cross_reference_exists?
(
noteable
,
mentioner
)
def
self
.
cross_reference_exists?
(
noteable
,
mentioner
)
# Initial scope should be system notes of this noteable type
# Initial scope should be system notes of this noteable type
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
notes
=
Note
.
system
.
where
(
noteable_type:
noteable
.
class
)
...
@@ -291,10 +294,7 @@ class SystemNoteService
...
@@ -291,10 +294,7 @@ class SystemNoteService
notes
=
notes
.
where
(
noteable_id:
noteable
.
id
)
notes
=
notes
.
where
(
noteable_id:
noteable
.
id
)
end
end
gfm_reference
=
mentioner
.
gfm_reference
(
noteable
.
project
)
notes_for_mentioner
(
mentioner
,
noteable
,
notes
).
count
>
0
notes
=
notes
.
where
(
note:
cross_reference_note_content
(
gfm_reference
))
notes
.
count
>
0
end
end
# Called when the merge request is approved by user
# Called when the merge request is approved by user
...
@@ -315,6 +315,15 @@ class SystemNoteService
...
@@ -315,6 +315,15 @@ class SystemNoteService
private
private
def
self
.
notes_for_mentioner
(
mentioner
,
noteable
,
notes
)
if
mentioner
.
is_a?
(
Commit
)
notes
.
where
(
'note LIKE ?'
,
"
#{
cross_reference_note_prefix
}
%
#{
mentioner
.
to_reference
(
nil
)
}
"
)
else
gfm_reference
=
mentioner
.
gfm_reference
(
noteable
.
project
)
notes
.
where
(
note:
cross_reference_note_content
(
gfm_reference
))
end
end
def
self
.
create_note
(
args
=
{})
def
self
.
create_note
(
args
=
{})
Note
.
create
(
args
.
merge
(
system:
true
))
Note
.
create
(
args
.
merge
(
system:
true
))
end
end
...
...
app/views/projects/diffs/_image.html.haml
View file @
d4efdaaf
-
diff
=
diff_file
.
diff
-
diff
=
diff_file
.
diff
-
file
.
load_all_data!
(
@project
.
repository
)
-
if
diff
.
renamed_file
||
diff
.
new_file
||
diff
.
deleted_file
-
if
diff
.
renamed_file
||
diff
.
new_file
||
diff
.
deleted_file
.image
.image
%span
.wrap
%span
.wrap
...
@@ -6,6 +7,7 @@
...
@@ -6,6 +7,7 @@
%img
{
src:
"data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"
}
%img
{
src:
"data:#{file.mime_type};base64,#{Base64.encode64(file.data)}"
}
%p
.image-info
=
"
#{
number_to_human_size
file
.
size
}
"
%p
.image-info
=
"
#{
number_to_human_size
file
.
size
}
"
-
else
-
else
-
old_file
.
load_all_data!
(
@project
.
repository
)
.image
.image
%div
.two-up.view
%div
.two-up.view
%span
.wrap
%span
.wrap
...
...
app/views/shared/issuable/_sidebar.html.haml
View file @
d4efdaaf
...
@@ -4,21 +4,18 @@
...
@@ -4,21 +4,18 @@
%span
.issuable-count.pull-left
%span
.issuable-count.pull-left
=
issuable
.
iid
=
issuable
.
iid
of
of
=
issuable
_count
(
:all
,
@project
)
=
issuable
s_count
(
issuable
)
%span
.pull-right
%span
.pull-right
%a
.gutter-toggle
{
href:
'#'
}
%a
.gutter-toggle
{
href:
'#'
}
-
if
sidebar_gutter_collapsed?
=
sidebar_gutter_toggle_icon
=
icon
(
'angle-double-left'
)
-
else
=
icon
(
'angle-double-right'
)
.issuable-nav.pull-right.btn-group
{
role:
'group'
,
"aria-label"
=>
'...'
}
.issuable-nav.pull-right.btn-group
{
role:
'group'
,
"aria-label"
=>
'...'
}
-
if
has_prev_issuable?
(
@project
,
issuable
.
id
)
-
if
prev_issuable
=
prev_issuable_for
(
issuable
)
=
link_to
'Prev'
,
issuable_link_prev
(
@project
,
issuable
)
,
class:
'btn btn-default prev-btn'
=
link_to
'Prev'
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
prev_issuable
]
,
class:
'btn btn-default prev-btn'
-
else
-
else
%a
.btn.btn-default.disabled
{
href:
'#'
}
%a
.btn.btn-default.disabled
{
href:
'#'
}
Prev
Prev
-
if
has_next_issuable?
(
@project
,
issuable
.
id
)
-
if
next_issuable
=
next_issuable_for
(
issuable
)
=
link_to
'Next'
,
issuable_link_next
(
@project
,
issuable
)
,
class:
'btn btn-default next-btn'
=
link_to
'Next'
,
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
next_issuable
]
,
class:
'btn btn-default next-btn'
-
else
-
else
%a
.btn.btn-default.disabled
{
href:
'#'
}
%a
.btn.btn-default.disabled
{
href:
'#'
}
Next
Next
...
@@ -142,7 +139,7 @@
...
@@ -142,7 +139,7 @@
-
project_ref
=
cross_project_reference
(
@project
,
issuable
)
-
project_ref
=
cross_project_reference
(
@project
,
issuable
)
.block.project-reference
.block.project-reference
.sidebar-collapsed-icon
.sidebar-collapsed-icon
=
icon
(
'clipboard'
)
=
clipboard_button
(
clipboard_text:
project_ref
)
.title
.title
.cross-project-reference
.cross-project-reference
%span
%span
...
...
doc/ci/variables/README.md
View file @
d4efdaaf
...
@@ -16,7 +16,7 @@ The API_TOKEN will take the Secure Variable value: `SECURE`.
...
@@ -16,7 +16,7 @@ The API_TOKEN will take the Secure Variable value: `SECURE`.
### Predefined variables (Environment Variables)
### Predefined variables (Environment Variables)
| Variable | Runner | Description |
| Variable | Runner | Description |
|-------------------------|-------------|
|-------------------------|-----
|
--------|
|
**CI**
| 0.4 | Mark that build is executed in CI environment |
|
**CI**
| 0.4 | Mark that build is executed in CI environment |
|
**GITLAB_CI**
| all | Mark that build is executed in GitLab CI environment |
|
**GITLAB_CI**
| all | Mark that build is executed in GitLab CI environment |
|
**CI_SERVER**
| all | Mark that build is executed in CI environment |
|
**CI_SERVER**
| all | Mark that build is executed in CI environment |
...
...
doc/install/installation.md
View file @
d4efdaaf
...
@@ -182,25 +182,20 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
...
@@ -182,25 +182,20 @@ We recommend using a PostgreSQL database. For MySQL check [MySQL setup guide](da
## 6. Redis
## 6. Redis
As of this writing, most Debian/Ubuntu distributions ship with Redis 2.2 or
GitLab requires at least Redis 2.8.
2.
4. GitLab requires at least Redis 2.8.
Ubuntu users
[
can use a PPA
](
https://launchpad.net/~chris-lea/+archive/ubuntu/redis-server
)
If you are using Debian 8 or Ubuntu 14.04 and up, then you can simply install
to install a recent version of Redis.
Redis 2.8 with:
The following instructions cover building and installing Redis from scratch:
```
sh
```
sh
# Build Redis
sudo
apt-get
install
redis-server
wget http://download.redis.io/releases/redis-2.8.23.tar.gz
```
tar
xzf redis-2.8.23.tar.gz
cd
redis-2.8.23
make
# Install Redis
If you are using Debian 7 or Ubuntu 12.04, follow the special documentation
cd
utils
on
[
an alternate Redis installation
](
redis.md
)
. Once done, follow the rest of
sudo
./install_server.sh
the guide here.
```
# Configure redis to use sockets
# Configure redis to use sockets
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig
...
@@ -224,7 +219,7 @@ if [ -d /etc/tmpfiles.d ]; then
...
@@ -224,7 +219,7 @@ if [ -d /etc/tmpfiles.d ]; then
fi
fi
# Activate the changes to redis.conf
# Activate the changes to redis.conf
sudo
service redis
_6379
start
sudo service redis
-server re
start
# Add git to the redis group
# Add git to the redis group
sudo usermod -aG redis git
sudo usermod -aG redis git
...
...
doc/install/redis.md
0 → 100644
View file @
d4efdaaf
# Install Redis on old distributions
GitLab requires at least Redis 2.8. The following guide is for Debian 7 and
Ubuntu 12.04. If you are using Debian 8 or Ubuntu 14.04 and up, follow the
[
installation guide
](
installation.md
)
.
## Install Redis 2.8 in Debian 7
Redis 2.8 is included in the Debian Wheezy [backports] repository.
1.
Edit
`/etc/apt/sources.list`
and add the following line:
```
deb http://http.debian.net/debian wheezy-backports main
```
1.
Update the repositories:
```
sudo apt-get update
```
1.
Install
`redis-server`
:
```
sudo apt-get -t wheezy-backports install redis-server
```
1.
Follow the rest of the
[
installation guide
](
installation.md
)
.
## Install Redis 2.8 in Ubuntu 12.04
We will
[
use a PPA
](
https://launchpad.net/~chris-lea/+archive/ubuntu/redis-server
)
to install a recent version of Redis.
1.
Install the PPA repository:
```
sudo add-apt-repository ppa:chris-lea/redis-server
```
Your system will now fetch the PPA's key. This enables your Ubuntu system to
verify that the packages in the PPA have not been interfered with since they
were built.
1.
Update the repositories:
```
sudo apt-get update
```
1.
Install
`redis-server`
:
```
sudo apt-get install redis-server
```
1.
Follow the rest of the
[
installation guide
](
installation.md
)
.
[
backports
]:
http://backports.debian.org/Instructions/
"Debian backports website"
doc/web_hooks/web_hooks.md
View file @
d4efdaaf
This diff is collapsed.
Click to expand it.
features/project/issues/issues.feature
View file @
d4efdaaf
...
@@ -25,9 +25,16 @@ Feature: Project Issues
...
@@ -25,9 +25,16 @@ Feature: Project Issues
Scenario
:
I
visit issue page
Scenario
:
I
visit issue page
Given
I click link
"Release 0.4"
Given
I click link
"Release 0.4"
Then
I should see issue
"Release 0.4"
Then
I should see issue
"Release 0.4"
And
I should see
"1 of 2"
in the sidebar
Scenario
:
I
navigate between issues
Given
I click link
"Release 0.4"
Then
I click link
"Next"
in the sidebar
Then
I should see issue
"Tweet control"
And
I should see
"2 of 2"
in the sidebar
@javascript
@javascript
Scenario
:
I
visit issue page
Scenario
:
I
filter by author
Given
I add a user to project
"Shop"
Given
I add a user to project
"Shop"
And
I click
"author"
dropdown
And
I click
"author"
dropdown
Then
I see current user as the first user
Then
I see current user as the first user
...
...
features/project/merge_requests.feature
View file @
d4efdaaf
...
@@ -39,6 +39,7 @@ Feature: Project Merge Requests
...
@@ -39,6 +39,7 @@ Feature: Project Merge Requests
Scenario
:
I
visit merge request page
Scenario
:
I
visit merge request page
Given
I click link
"Bug NS-04"
Given
I click link
"Bug NS-04"
Then
I should see merge request
"Bug NS-04"
Then
I should see merge request
"Bug NS-04"
And
I should see
"1 of 1"
in the sidebar
Scenario
:
I
close merge request page
Scenario
:
I
close merge request page
Given
I click link
"Bug NS-04"
Given
I click link
"Bug NS-04"
...
...
features/steps/project/issues/award_emoji.rb
View file @
d4efdaaf
...
@@ -46,6 +46,8 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
...
@@ -46,6 +46,8 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
end
end
step
'I have award added'
do
step
'I have award added'
do
sleep
0.2
page
.
within
'.awards'
do
page
.
within
'.awards'
do
expect
(
page
).
to
have_selector
'.award'
expect
(
page
).
to
have_selector
'.award'
expect
(
page
.
find
(
'.award.active .counter'
)).
to
have_content
'1'
expect
(
page
.
find
(
'.award.active .counter'
)).
to
have_content
'1'
...
...
features/steps/project/issues/issues.rb
View file @
d4efdaaf
...
@@ -54,6 +54,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -54,6 +54,10 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
expect
(
page
).
to
have_content
"Release 0.4"
expect
(
page
).
to
have_content
"Release 0.4"
end
end
step
'I should see issue "Tweet control"'
do
expect
(
page
).
to
have_content
"Tweet control"
end
step
'I click link "New Issue"'
do
step
'I click link "New Issue"'
do
click_link
"New Issue"
click_link
"New Issue"
end
end
...
@@ -301,4 +305,5 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
...
@@ -301,4 +305,5 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
def
filter_issue
(
text
)
def
filter_issue
(
text
)
fill_in
'issue_search'
,
with:
text
fill_in
'issue_search'
,
with:
text
end
end
end
end
features/steps/shared/issuable.rb
View file @
d4efdaaf
...
@@ -119,6 +119,24 @@ module SharedIssuable
...
@@ -119,6 +119,24 @@ module SharedIssuable
end
end
end
end
step
'I should see "1 of 1" in the sidebar'
do
expect_sidebar_content
(
'1 of 1'
)
end
step
'I should see "1 of 2" in the sidebar'
do
expect_sidebar_content
(
'1 of 2'
)
end
step
'I should see "2 of 2" in the sidebar'
do
expect_sidebar_content
(
'2 of 2'
)
end
step
'I click link "Next" in the sidebar'
do
page
.
within
'.issuable-sidebar'
do
click_link
'Next'
end
end
def
create_issuable_for_project
(
project_name
:,
title
:,
type: :issue
)
def
create_issuable_for_project
(
project_name
:,
title
:,
type: :issue
)
project
=
Project
.
find_by
(
name:
project_name
)
project
=
Project
.
find_by
(
name:
project_name
)
...
@@ -159,4 +177,10 @@ module SharedIssuable
...
@@ -159,4 +177,10 @@ module SharedIssuable
expect
(
page
).
to
have_content
(
"mentioned in
#{
issuable
.
class
.
to_s
.
titleize
.
downcase
}
#{
issuable
.
to_reference
(
project
)
}
"
)
expect
(
page
).
to
have_content
(
"mentioned in
#{
issuable
.
class
.
to_s
.
titleize
.
downcase
}
#{
issuable
.
to_reference
(
project
)
}
"
)
end
end
def
expect_sidebar_content
(
content
)
page
.
within
'.issuable-sidebar'
do
expect
(
page
).
to
have_content
content
end
end
end
end
lib/gitlab/note_data_builder.rb
View file @
d4efdaaf
...
@@ -53,13 +53,10 @@ module Gitlab
...
@@ -53,13 +53,10 @@ module Gitlab
object_kind:
"note"
,
object_kind:
"note"
,
user:
user
.
hook_attrs
,
user:
user
.
hook_attrs
,
project_id:
project
.
id
,
project_id:
project
.
id
,
repository:
{
project:
project
.
hook_attrs
,
name:
project
.
name
,
object_attributes:
note
.
hook_attrs
,
url:
project
.
url_to_repo
,
# DEPRECATED
description:
project
.
description
,
repository:
project
.
hook_attrs
.
slice
(
:name
,
:url
,
:description
,
:homepage
)
homepage:
project
.
web_url
,
},
object_attributes:
note
.
hook_attrs
}
}
base_data
[
:object_attributes
][
:url
]
=
base_data
[
:object_attributes
][
:url
]
=
...
...
lib/gitlab/push_data_builder.rb
View file @
d4efdaaf
...
@@ -47,18 +47,14 @@ module Gitlab
...
@@ -47,18 +47,14 @@ module Gitlab
user_id:
user
.
id
,
user_id:
user
.
id
,
user_name:
user
.
name
,
user_name:
user
.
name
,
user_email:
user
.
email
,
user_email:
user
.
email
,
user_avatar:
user
.
avatar_url
,
project_id:
project
.
id
,
project_id:
project
.
id
,
repository:
{
project:
project
.
hook_attrs
,
name:
project
.
name
,
url:
project
.
url_to_repo
,
description:
project
.
description
,
homepage:
project
.
web_url
,
git_http_url:
project
.
http_url_to_repo
,
git_ssh_url:
project
.
ssh_url_to_repo
,
visibility_level:
project
.
visibility_level
},
commits:
commit_attrs
,
commits:
commit_attrs
,
total_commits_count:
commits_count
total_commits_count:
commits_count
,
# DEPRECATED
repository:
project
.
hook_attrs
.
slice
(
:name
,
:url
,
:description
,
:homepage
,
:git_http_url
,
:git_ssh_url
,
:visibility_level
)
}
}
data
data
...
...
spec/controllers/projects/commit_controller_spec.rb
0 → 100644
View file @
d4efdaaf
require
'rails_helper'
describe
Projects
::
CommitController
do
describe
'GET show'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
user
=
create
(
:user
)
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
end
context
'with valid id'
do
it
'responds with 200'
do
go
id:
project
.
commit
.
id
expect
(
response
).
to
be_ok
end
end
context
'with invalid id'
do
it
'responds with 404'
do
go
id:
project
.
commit
.
id
.
reverse
expect
(
response
).
to
be_not_found
end
end
def
go
(
id
:)
get
:show
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
id
end
end
end
spec/lib/gitlab/note_data_builder_spec.rb
View file @
d4efdaaf
...
@@ -16,62 +16,80 @@ describe 'Gitlab::NoteDataBuilder', lib: true do
...
@@ -16,62 +16,80 @@ describe 'Gitlab::NoteDataBuilder', lib: true do
end
end
describe
'When asking for a note on commit'
do
describe
'When asking for a note on commit'
do
let
(
:note
)
{
create
(
:note_on_commit
)
}
let
(
:note
)
{
create
(
:note_on_commit
,
project:
project
)
}
it
'returns the note and commit-specific data'
do
it
'returns the note and commit-specific data'
do
expect
(
data
).
to
have_key
(
:commit
)
expect
(
data
).
to
have_key
(
:commit
)
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
'When asking for a note on commit diff'
do
describe
'When asking for a note on commit diff'
do
let
(
:note
)
{
create
(
:note_on_commit_diff
)
}
let
(
:note
)
{
create
(
:note_on_commit_diff
,
project:
project
)
}
it
'returns the note and commit-specific data'
do
it
'returns the note and commit-specific data'
do
expect
(
data
).
to
have_key
(
:commit
)
expect
(
data
).
to
have_key
(
:commit
)
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
'When asking for a note on issue'
do
describe
'When asking for a note on issue'
do
let
(
:issue
)
{
create
(
:issue
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let
(
:issue
)
{
create
(
:issue
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable_id:
issue
.
id
)
}
let
(
:note
)
{
create
(
:note_on_issue
,
noteable_id:
issue
.
id
,
project:
project
)
}
it
'returns the note and issue-specific data'
do
it
'returns the note and issue-specific data'
do
expect
(
data
).
to
have_key
(
:issue
)
expect
(
data
).
to
have_key
(
:issue
)
expect
(
data
[
:issue
].
except
(
'updated_at'
)).
to
eq
(
issue
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:issue
].
except
(
'updated_at'
)).
to
eq
(
issue
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:issue
][
'updated_at'
]).
to
be
>
issue
.
hook_attrs
[
'updated_at'
]
expect
(
data
[
:issue
][
'updated_at'
]).
to
be
>
issue
.
hook_attrs
[
'updated_at'
]
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
'When asking for a note on merge request'
do
describe
'When asking for a note on merge request'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let
(
:note
)
{
create
(
:note_on_merge_request
,
noteable_id:
merge_request
.
id
)
}
let
(
:note
)
{
create
(
:note_on_merge_request
,
noteable_id:
merge_request
.
id
,
project:
project
)
}
it
'returns the note and merge request data'
do
it
'returns the note and merge request data'
do
expect
(
data
).
to
have_key
(
:merge_request
)
expect
(
data
).
to
have_key
(
:merge_request
)
expect
(
data
[
:merge_request
].
except
(
'updated_at'
)).
to
eq
(
merge_request
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:merge_request
].
except
(
'updated_at'
)).
to
eq
(
merge_request
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:merge_request
][
'updated_at'
]).
to
be
>
merge_request
.
hook_attrs
[
'updated_at'
]
expect
(
data
[
:merge_request
][
'updated_at'
]).
to
be
>
merge_request
.
hook_attrs
[
'updated_at'
]
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
'When asking for a note on merge request diff'
do
describe
'When asking for a note on merge request diff'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let
(
:note
)
{
create
(
:note_on_merge_request_diff
,
noteable_id:
merge_request
.
id
)
}
let
(
:note
)
{
create
(
:note_on_merge_request_diff
,
noteable_id:
merge_request
.
id
,
project:
project
)
}
it
'returns the note and merge request diff data'
do
it
'returns the note and merge request diff data'
do
expect
(
data
).
to
have_key
(
:merge_request
)
expect
(
data
).
to
have_key
(
:merge_request
)
expect
(
data
[
:merge_request
].
except
(
'updated_at'
)).
to
eq
(
merge_request
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:merge_request
].
except
(
'updated_at'
)).
to
eq
(
merge_request
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:merge_request
][
'updated_at'
]).
to
be
>
merge_request
.
hook_attrs
[
'updated_at'
]
expect
(
data
[
:merge_request
][
'updated_at'
]).
to
be
>
merge_request
.
hook_attrs
[
'updated_at'
]
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
'When asking for a note on project snippet'
do
describe
'When asking for a note on project snippet'
do
let!
(
:snippet
)
{
create
(
:project_snippet
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let!
(
:snippet
)
{
create
(
:project_snippet
,
created_at:
fixed_time
,
updated_at:
fixed_time
)
}
let!
(
:note
)
{
create
(
:note_on_project_snippet
,
noteable_id:
snippet
.
id
)
}
let!
(
:note
)
{
create
(
:note_on_project_snippet
,
noteable_id:
snippet
.
id
,
project:
project
)
}
it
'returns the note and project snippet data'
do
it
'returns the note and project snippet data'
do
expect
(
data
).
to
have_key
(
:snippet
)
expect
(
data
).
to
have_key
(
:snippet
)
expect
(
data
[
:snippet
].
except
(
'updated_at'
)).
to
eq
(
snippet
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:snippet
].
except
(
'updated_at'
)).
to
eq
(
snippet
.
hook_attrs
.
except
(
'updated_at'
))
expect
(
data
[
:snippet
][
'updated_at'
]).
to
be
>
snippet
.
hook_attrs
[
'updated_at'
]
expect
(
data
[
:snippet
][
'updated_at'
]).
to
be
>
snippet
.
hook_attrs
[
'updated_at'
]
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
end
end
spec/lib/gitlab/push_data_builder_spec.rb
View file @
d4efdaaf
...
@@ -13,13 +13,13 @@ describe 'Gitlab::PushDataBuilder', lib: true do
...
@@ -13,13 +13,13 @@ describe 'Gitlab::PushDataBuilder', lib: true do
it
{
expect
(
data
[
:after
]).
to
eq
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
it
{
expect
(
data
[
:after
]).
to
eq
(
'5937ac0a7beb003549fc5fd26fc247adbce4a52e'
)
}
it
{
expect
(
data
[
:ref
]).
to
eq
(
'refs/heads/master'
)
}
it
{
expect
(
data
[
:ref
]).
to
eq
(
'refs/heads/master'
)
}
it
{
expect
(
data
[
:commits
].
size
).
to
eq
(
3
)
}
it
{
expect
(
data
[
:commits
].
size
).
to
eq
(
3
)
}
it
{
expect
(
data
[
:repository
][
:git_http_url
]).
to
eq
(
project
.
http_url_to_repo
)
}
it
{
expect
(
data
[
:repository
][
:git_ssh_url
]).
to
eq
(
project
.
ssh_url_to_repo
)
}
it
{
expect
(
data
[
:repository
][
:visibility_level
]).
to
eq
(
project
.
visibility_level
)
}
it
{
expect
(
data
[
:total_commits_count
]).
to
eq
(
3
)
}
it
{
expect
(
data
[
:total_commits_count
]).
to
eq
(
3
)
}
it
{
expect
(
data
[
:commits
].
first
[
:added
]).
to
eq
([
"gitlab-grack"
])
}
it
{
expect
(
data
[
:commits
].
first
[
:added
]).
to
eq
([
"gitlab-grack"
])
}
it
{
expect
(
data
[
:commits
].
first
[
:modified
]).
to
eq
([
".gitmodules"
])
}
it
{
expect
(
data
[
:commits
].
first
[
:modified
]).
to
eq
([
".gitmodules"
])
}
it
{
expect
(
data
[
:commits
].
first
[
:removed
]).
to
eq
([])
}
it
{
expect
(
data
[
:commits
].
first
[
:removed
]).
to
eq
([])
}
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
:build
do
describe
:build
do
...
...
spec/models/concerns/issuable_spec.rb
View file @
d4efdaaf
...
@@ -69,27 +69,28 @@ describe Issue, "Issuable" do
...
@@ -69,27 +69,28 @@ describe Issue, "Issuable" do
end
end
describe
"#to_hook_data"
do
describe
"#to_hook_data"
do
let
(
:hook_data
)
{
issue
.
to_hook_data
(
user
)
}
let
(
:data
)
{
issue
.
to_hook_data
(
user
)
}
let
(
:project
)
{
issue
.
project
}
it
"returns correct hook data"
do
it
"returns correct hook data"
do
expect
(
hook_data
[
:object_kind
]).
to
eq
(
"issue"
)
expect
(
data
[
:object_kind
]).
to
eq
(
"issue"
)
expect
(
hook_data
[
:user
]).
to
eq
(
user
.
hook_attrs
)
expect
(
data
[
:user
]).
to
eq
(
user
.
hook_attrs
)
expect
(
hook_data
[
:repository
][
:name
]).
to
eq
(
issue
.
project
.
name
)
expect
(
data
[
:object_attributes
]).
to
eq
(
issue
.
hook_attrs
)
expect
(
hook_data
[
:repository
][
:url
]).
to
eq
(
issue
.
project
.
url_to_repo
)
expect
(
data
).
to_not
have_key
(
:assignee
)
expect
(
hook_data
[
:repository
][
:description
]).
to
eq
(
issue
.
project
.
description
)
expect
(
hook_data
[
:repository
][
:homepage
]).
to
eq
(
issue
.
project
.
web_url
)
expect
(
hook_data
[
:object_attributes
]).
to
eq
(
issue
.
hook_attrs
)
expect
(
hook_data
).
to_not
have_key
(
:assignee
)
end
end
context
"issue is assigned"
do
context
"issue is assigned"
do
before
{
issue
.
update_attribute
(
:assignee
,
user
)
}
before
{
issue
.
update_attribute
(
:assignee
,
user
)
}
it
"returns correct hook data"
do
it
"returns correct hook data"
do
expect
(
hook_
data
[
:object_attributes
][
'assignee_id'
]).
to
eq
(
user
.
id
)
expect
(
data
[
:object_attributes
][
'assignee_id'
]).
to
eq
(
user
.
id
)
expect
(
hook_
data
[
:assignee
]).
to
eq
(
user
.
hook_attrs
)
expect
(
data
[
:assignee
]).
to
eq
(
user
.
hook_attrs
)
end
end
end
end
include_examples
'project hook data'
include_examples
'deprecated repository hook data'
end
end
describe
'#card_attributes'
do
describe
'#card_attributes'
do
...
...
spec/models/merge_request_spec.rb
View file @
d4efdaaf
...
@@ -278,13 +278,22 @@ describe MergeRequest, models: true do
...
@@ -278,13 +278,22 @@ describe MergeRequest, models: true do
end
end
describe
"#hook_attrs"
do
describe
"#hook_attrs"
do
let
(
:attrs_hash
)
{
subject
.
hook_attrs
.
to_h
}
[
:source
,
:target
].
each
do
|
key
|
describe
"
#{
key
}
key"
do
include_examples
'project hook data'
,
project_key:
key
do
let
(
:data
)
{
attrs_hash
}
let
(
:project
)
{
subject
.
send
(
"
#{
key
}
_project"
)
}
end
end
end
it
"has all the required keys"
do
it
"has all the required keys"
do
attrs
=
subject
.
hook_attrs
expect
(
attrs_hash
).
to
include
(
:source
)
attrs
=
attrs
.
to_h
expect
(
attrs_hash
).
to
include
(
:target
)
expect
(
attrs
).
to
include
(
:source
)
expect
(
attrs_hash
).
to
include
(
:last_commit
)
expect
(
attrs
).
to
include
(
:target
)
expect
(
attrs_hash
).
to
include
(
:work_in_progress
)
expect
(
attrs
).
to
include
(
:last_commit
)
expect
(
attrs
).
to
include
(
:work_in_progress
)
end
end
end
end
...
...
spec/services/system_note_service_spec.rb
View file @
d4efdaaf
...
@@ -424,6 +424,21 @@ describe SystemNoteService, services: true do
...
@@ -424,6 +424,21 @@ describe SystemNoteService, services: true do
to
be_falsey
to
be_falsey
end
end
end
end
context
'commit with cross-reference from fork'
do
let
(
:author2
)
{
create
(
:user
)
}
let
(
:forked_project
)
{
Projects
::
ForkService
.
new
(
project
,
author2
).
execute
}
let
(
:commit2
)
{
forked_project
.
commit
}
before
do
described_class
.
cross_reference
(
noteable
,
commit0
,
author2
)
end
it
'is true when a fork mentions an external issue'
do
expect
(
described_class
.
cross_reference_exists?
(
noteable
,
commit2
)).
to
be
true
end
end
end
end
include
JiraServiceHelper
include
JiraServiceHelper
...
...
spec/support/project_hook_data_shared_example.rb
0 → 100644
View file @
d4efdaaf
RSpec
.
shared_examples
'project hook data'
do
|
project_key: :project
|
it
'contains project data'
do
expect
(
data
[
project_key
][
:name
]).
to
eq
(
project
.
name
)
expect
(
data
[
project_key
][
:description
]).
to
eq
(
project
.
description
)
expect
(
data
[
project_key
][
:web_url
]).
to
eq
(
project
.
web_url
)
expect
(
data
[
project_key
][
:avatar_url
]).
to
eq
(
project
.
avatar_url
)
expect
(
data
[
project_key
][
:git_http_url
]).
to
eq
(
project
.
http_url_to_repo
)
expect
(
data
[
project_key
][
:git_ssh_url
]).
to
eq
(
project
.
ssh_url_to_repo
)
expect
(
data
[
project_key
][
:namespace
]).
to
eq
(
project
.
namespace
.
name
)
expect
(
data
[
project_key
][
:visibility_level
]).
to
eq
(
project
.
visibility_level
)
expect
(
data
[
project_key
][
:path_with_namespace
]).
to
eq
(
project
.
path_with_namespace
)
expect
(
data
[
project_key
][
:default_branch
]).
to
eq
(
project
.
default_branch
)
expect
(
data
[
project_key
][
:homepage
]).
to
eq
(
project
.
web_url
)
expect
(
data
[
project_key
][
:url
]).
to
eq
(
project
.
url_to_repo
)
expect
(
data
[
project_key
][
:ssh_url
]).
to
eq
(
project
.
ssh_url_to_repo
)
expect
(
data
[
project_key
][
:http_url
]).
to
eq
(
project
.
http_url_to_repo
)
end
end
RSpec
.
shared_examples
'deprecated repository hook data'
do
|
project_key: :project
|
it
'contains deprecated repository data'
do
expect
(
data
[
:repository
][
:name
]).
to
eq
(
project
.
name
)
expect
(
data
[
:repository
][
:description
]).
to
eq
(
project
.
description
)
expect
(
data
[
:repository
][
:url
]).
to
eq
(
project
.
url_to_repo
)
expect
(
data
[
:repository
][
:homepage
]).
to
eq
(
project
.
web_url
)
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