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
7cb1d506
Commit
7cb1d506
authored
Aug 19, 2016
by
Ruben Davila
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'ce/8-11-stable' into 8-11-stable-ee
parents
7118a669
658ebce4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
101 additions
and
89 deletions
+101
-89
CHANGELOG
CHANGELOG
+0
-1
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+11
-8
app/models/project.rb
app/models/project.rb
+4
-1
app/views/projects/protected_branches/_create_protected_branch.html.haml
...cts/protected_branches/_create_protected_branch.html.haml
+8
-6
lib/gitlab/email/handler.rb
lib/gitlab/email/handler.rb
+2
-1
spec/features/issues_spec.rb
spec/features/issues_spec.rb
+1
-1
spec/features/protected_branches/access_control_ce_spec.rb
spec/features/protected_branches/access_control_ce_spec.rb
+71
-0
spec/features/protected_branches_spec.rb
spec/features/protected_branches_spec.rb
+2
-69
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
7cb1d506
...
...
@@ -86,7 +86,6 @@ v 8.11.0 (unreleased)
- Add archived badge to project list !5798
- Add simple identifier to public SSH keys (muteor)
- Admin page now references docs instead of a specific file !5600 (AnAverageHuman)
- Add a way to send an email and create an issue based on private personal token. Find the email address from issues page. !3363
- Fix filter input alignment (ClemMakesApps)
- Include old revision in merge request update hooks (Ben Boeckel)
- Add build event color in HipChat messages (David Eisner)
...
...
app/assets/javascripts/gl_dropdown.js
View file @
7cb1d506
...
...
@@ -470,7 +470,8 @@
}
else
{
if
(
!
selected
)
{
value
=
this
.
options
.
id
?
this
.
options
.
id
(
data
)
:
data
.
id
;
fieldName
=
this
.
options
.
fieldName
;
fieldName
=
typeof
this
.
options
.
fieldName
===
'
function
'
?
this
.
options
.
fieldName
()
:
this
.
options
.
fieldName
;
field
=
this
.
dropdown
.
parent
().
find
(
"
input[name='
"
+
fieldName
+
"
'][value='
"
+
value
+
"
']
"
);
if
(
field
.
length
)
{
selected
=
true
;
...
...
@@ -533,7 +534,6 @@
GitLabDropdown
.
prototype
.
rowClicked
=
function
(
el
)
{
var
field
,
fieldName
,
groupName
,
isInput
,
selectedIndex
,
selectedObject
,
value
;
fieldName
=
this
.
options
.
fieldName
;
isInput
=
$
(
this
.
el
).
is
(
'
input
'
);
if
(
this
.
renderedData
)
{
groupName
=
el
.
data
(
'
group
'
);
...
...
@@ -545,6 +545,7 @@
selectedObject
=
this
.
renderedData
[
selectedIndex
];
}
}
fieldName
=
typeof
this
.
options
.
fieldName
===
'
function
'
?
this
.
options
.
fieldName
(
selectedObject
)
:
this
.
options
.
fieldName
;
value
=
this
.
options
.
id
?
this
.
options
.
id
(
selectedObject
,
el
)
:
selectedObject
.
id
;
if
(
isInput
)
{
field
=
$
(
this
.
el
);
...
...
@@ -559,10 +560,9 @@
field
.
remove
();
}
if
(
this
.
options
.
toggleLabel
)
{
return
this
.
updateLabel
(
selectedObject
,
el
,
this
);
}
else
{
return
selectedObject
;
this
.
updateLabel
(
selectedObject
,
el
,
this
);
}
return
selectedObject
;
}
else
if
(
el
.
hasClass
(
INDETERMINATE_CLASS
))
{
el
.
addClass
(
ACTIVE_CLASS
);
el
.
removeClass
(
INDETERMINATE_CLASS
);
...
...
@@ -570,7 +570,7 @@
field
.
remove
();
}
if
(
!
field
.
length
&&
fieldName
)
{
this
.
addInput
(
fieldName
,
value
);
this
.
addInput
(
fieldName
,
value
,
selectedObject
);
}
return
selectedObject
;
}
else
{
...
...
@@ -589,7 +589,7 @@
}
if
(
value
!=
null
)
{
if
(
!
field
.
length
&&
fieldName
)
{
this
.
addInput
(
fieldName
,
value
);
this
.
addInput
(
fieldName
,
value
,
selectedObject
);
}
else
{
field
.
val
(
value
).
trigger
(
'
change
'
);
}
...
...
@@ -598,12 +598,15 @@
}
};
GitLabDropdown
.
prototype
.
addInput
=
function
(
fieldName
,
value
)
{
GitLabDropdown
.
prototype
.
addInput
=
function
(
fieldName
,
value
,
selectedObject
)
{
var
$input
;
$input
=
$
(
'
<input>
'
).
attr
(
'
type
'
,
'
hidden
'
).
attr
(
'
name
'
,
fieldName
).
val
(
value
);
if
(
this
.
options
.
inputId
!=
null
)
{
$input
.
attr
(
'
id
'
,
this
.
options
.
inputId
);
}
if
(
selectedObject
&&
selectedObject
.
type
)
{
$input
.
attr
(
'
data-type
'
,
selectedObject
.
type
);
}
return
this
.
dropdown
.
before
(
$input
);
};
...
...
app/models/project.rb
View file @
7cb1d506
...
...
@@ -703,7 +703,10 @@ class Project < ActiveRecord::Base
end
def
new_issue_address
(
author
)
if
Gitlab
::
IncomingEmail
.
enabled?
&&
author
# This feature is disabled for the time being.
return
nil
if
Gitlab
::
IncomingEmail
.
enabled?
&&
author
# rubocop:disable Lint/UnreachableCode
Gitlab
::
IncomingEmail
.
reply_address
(
"
#{
path_with_namespace
}
+
#{
author
.
authentication_token
}
"
)
end
...
...
app/views/projects/protected_branches/_create_protected_branch.html.haml
View file @
7cb1d506
...
...
@@ -22,16 +22,18 @@
%label
.col-md-2.text-right
{
for:
'merge_access_levels_attributes'
}
Allowed to merge:
.col-md-10
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-merge wide'
,
data:
{
field_name:
'protected_branch[merge_access_levels_attributes][0][access_level]'
,
input_id:
'merge_access_levels_attributes'
}})
.js-allowed-to-merge-container
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-merge wide'
,
data:
{
field_name:
'protected_branch[merge_access_levels_attributes][0][access_level]'
,
input_id:
'merge_access_levels_attributes'
}})
.form-group
%label
.col-md-2.text-right
{
for:
'push_access_levels_attributes'
}
Allowed to push:
.col-md-10
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-push wide'
,
data:
{
field_name:
'protected_branch[push_access_levels_attributes][0][access_level]'
,
input_id:
'push_access_levels_attributes'
}})
.js-allowed-to-push-container
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-push wide'
,
data:
{
field_name:
'protected_branch[push_access_levels_attributes][0][access_level]'
,
input_id:
'push_access_levels_attributes'
}})
.panel-footer
=
f
.
submit
'Protect'
,
class:
'btn-create btn'
,
disabled:
true
lib/gitlab/email/handler.rb
View file @
7cb1d506
...
...
@@ -4,7 +4,8 @@ require 'gitlab/email/handler/create_issue_handler'
module
Gitlab
module
Email
module
Handler
HANDLERS
=
[
CreateNoteHandler
,
CreateIssueHandler
]
# The `CreateIssueHandler` feature is disabled for the time being.
HANDLERS
=
[
CreateNoteHandler
]
def
self
.
for
(
mail
,
mail_key
)
HANDLERS
.
find
do
|
klass
|
...
...
spec/features/issues_spec.rb
View file @
7cb1d506
...
...
@@ -546,7 +546,7 @@ describe 'Issues', feature: true do
end
end
describe
'new issue by email'
do
x
describe
'new issue by email'
do
shared_examples
'show the email in the modal'
do
before
do
stub_incoming_email_setting
(
enabled:
true
,
address:
"p+%{key}@gl.ab"
)
...
...
spec/features/protected_branches/access_control_ce_spec.rb
0 → 100644
View file @
7cb1d506
RSpec
.
shared_examples
"protected branches > access control > CE"
do
ProtectedBranch
::
PushAccessLevel
.
human_access_levels
.
each
do
|
(
access_type_id
,
access_type_name
)
|
it
"allows creating protected branches that
#{
access_type_name
}
can push to"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
within
(
'.new_protected_branch'
)
do
allowed_to_push_button
=
find
(
".js-allowed-to-push"
)
unless
allowed_to_push_button
.
text
==
access_type_name
allowed_to_push_button
.
click
within
(
".dropdown.open .dropdown-menu"
)
{
click_on
access_type_name
}
end
end
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
to
eq
([
access_type_id
])
end
it
"allows updating protected branches so that
#{
access_type_name
}
can push to them"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
within
(
".protected-branches-list"
)
do
find
(
".js-allowed-to-push"
).
click
within
(
'.js-allowed-to-push-container'
)
{
click_on
access_type_name
}
end
wait_for_ajax
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
to
include
(
access_type_id
)
end
end
ProtectedBranch
::
MergeAccessLevel
.
human_access_levels
.
each
do
|
(
access_type_id
,
access_type_name
)
|
it
"allows creating protected branches that
#{
access_type_name
}
can merge to"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
within
(
'.new_protected_branch'
)
do
allowed_to_merge_button
=
find
(
".js-allowed-to-merge"
)
unless
allowed_to_merge_button
.
text
==
access_type_name
allowed_to_merge_button
.
click
within
(
".dropdown.open .dropdown-menu"
)
{
click_on
access_type_name
}
end
end
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
ProtectedBranch
.
last
.
merge_access_levels
.
map
(
&
:access_level
)).
to
eq
([
access_type_id
])
end
it
"allows updating protected branches so that
#{
access_type_name
}
can merge to them"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
within
(
".protected-branches-list"
)
do
find
(
".js-allowed-to-merge"
).
click
within
(
'.js-allowed-to-merge-container'
)
{
click_on
access_type_name
}
end
wait_for_ajax
expect
(
ProtectedBranch
.
last
.
merge_access_levels
.
map
(
&
:access_level
)).
to
include
(
access_type_id
)
end
end
end
spec/features/protected_branches_spec.rb
View file @
7cb1d506
require
'spec_helper'
Dir
[
"./spec/features/protected_branches/*.rb"
].
sort
.
each
{
|
f
|
require
f
}
feature
'Projected Branches'
,
feature:
true
,
js:
true
do
include
WaitForAjax
...
...
@@ -88,74 +89,6 @@ feature 'Projected Branches', feature: true, js: true do
end
describe
"access control"
do
ProtectedBranch
::
PushAccessLevel
.
human_access_levels
.
each
do
|
(
access_type_id
,
access_type_name
)
|
it
"allows creating protected branches that
#{
access_type_name
}
can push to"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
within
(
'.new_protected_branch'
)
do
allowed_to_push_button
=
find
(
".js-allowed-to-push"
)
unless
allowed_to_push_button
.
text
==
access_type_name
allowed_to_push_button
.
click
within
(
".dropdown.open .dropdown-menu"
)
{
click_on
access_type_name
}
end
end
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
to
eq
([
access_type_id
])
end
it
"allows updating protected branches so that
#{
access_type_name
}
can push to them"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
within
(
".protected-branches-list"
)
do
find
(
".js-allowed-to-push"
).
click
within
(
'.js-allowed-to-push-container'
)
{
click_on
access_type_name
}
end
wait_for_ajax
expect
(
ProtectedBranch
.
last
.
push_access_levels
.
map
(
&
:access_level
)).
to
include
(
access_type_id
)
end
end
ProtectedBranch
::
MergeAccessLevel
.
human_access_levels
.
each
do
|
(
access_type_id
,
access_type_name
)
|
it
"allows creating protected branches that
#{
access_type_name
}
can merge to"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
within
(
'.new_protected_branch'
)
do
allowed_to_merge_button
=
find
(
".js-allowed-to-merge"
)
unless
allowed_to_merge_button
.
text
==
access_type_name
allowed_to_merge_button
.
click
within
(
".dropdown.open .dropdown-menu"
)
{
click_on
access_type_name
}
end
end
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
expect
(
ProtectedBranch
.
last
.
merge_access_levels
.
map
(
&
:access_level
)).
to
eq
([
access_type_id
])
end
it
"allows updating protected branches so that
#{
access_type_name
}
can merge to them"
do
visit
namespace_project_protected_branches_path
(
project
.
namespace
,
project
)
set_protected_branch_name
(
'master'
)
click_on
"Protect"
expect
(
ProtectedBranch
.
count
).
to
eq
(
1
)
within
(
".protected-branches-list"
)
do
find
(
".js-allowed-to-merge"
).
click
within
(
'.js-allowed-to-merge-container'
)
{
click_on
access_type_name
}
end
wait_for_ajax
expect
(
ProtectedBranch
.
last
.
merge_access_levels
.
map
(
&
:access_level
)).
to
include
(
access_type_id
)
end
end
include_examples
"protected branches > access control > CE"
end
end
spec/lib/gitlab/email/handler/create_issue_handler_spec.rb
View file @
7cb1d506
require
'spec_helper'
require_relative
'../email_shared_blocks'
describe
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
,
lib:
true
do
x
describe
Gitlab
::
Email
::
Handler
::
CreateIssueHandler
,
lib:
true
do
include_context
:email_shared_context
it_behaves_like
:email_shared_examples
...
...
spec/models/project_spec.rb
View file @
7cb1d506
...
...
@@ -257,7 +257,7 @@ describe Project, models: true do
end
end
describe
"#new_issue_address"
do
x
describe
"#new_issue_address"
do
let
(
:project
)
{
create
(
:empty_project
,
path:
"somewhere"
)
}
let
(
:user
)
{
create
(
:user
)
}
...
...
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