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
519f35e4
Commit
519f35e4
authored
May 05, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix FE specs
parent
2c9c9a86
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
86 additions
and
49 deletions
+86
-49
app/assets/javascripts/blob/file_template_mediator.js
app/assets/javascripts/blob/file_template_mediator.js
+5
-1
app/assets/javascripts/blob/file_template_selector.js
app/assets/javascripts/blob/file_template_selector.js
+10
-1
app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js
...s/javascripts/blob/template_selectors/ci_yaml_selector.js
+1
-1
app/assets/javascripts/blob/template_selectors/dockerfile_selector.js
...avascripts/blob/template_selectors/dockerfile_selector.js
+1
-1
app/assets/javascripts/blob/template_selectors/gitignore_selector.js
...javascripts/blob/template_selectors/gitignore_selector.js
+1
-1
app/assets/javascripts/blob/template_selectors/license_selector.js
...s/javascripts/blob/template_selectors/license_selector.js
+11
-2
app/assets/javascripts/blob/template_selectors/type_selector.js
...sets/javascripts/blob/template_selectors/type_selector.js
+1
-1
app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
...vascripts/protected_tags/protected_tag_access_dropdown.js
+2
-2
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
...sets/javascripts/protected_tags/protected_tag_dropdown.js
+2
-2
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+25
-16
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+4
-0
app/helpers/form_helper.rb
app/helpers/form_helper.rb
+5
-6
app/views/projects/protected_branches/_create_protected_branch.html.haml
...cts/protected_branches/_create_protected_branch.html.haml
+2
-2
app/views/projects/protected_branches/_update_protected_branch.html.haml
...cts/protected_branches/_update_protected_branch.html.haml
+2
-2
app/views/projects/protected_tags/_dropdown.html.haml
app/views/projects/protected_tags/_dropdown.html.haml
+1
-1
app/views/projects/protected_tags/_update_protected_tag.haml
app/views/projects/protected_tags/_update_protected_tag.haml
+1
-1
app/views/shared/issuable/form/_metadata.html.haml
app/views/shared/issuable/form/_metadata.html.haml
+3
-0
spec/policies/issue_policy_spec.rb
spec/policies/issue_policy_spec.rb
+4
-4
spec/services/members/authorized_destroy_service_spec.rb
spec/services/members/authorized_destroy_service_spec.rb
+3
-3
spec/services/users/destroy_service_spec.rb
spec/services/users/destroy_service_spec.rb
+2
-2
No files found.
app/assets/javascripts/blob/file_template_mediator.js
View file @
519f35e4
...
@@ -99,7 +99,7 @@ export default class FileTemplateMediator {
...
@@ -99,7 +99,7 @@ export default class FileTemplateMediator {
});
});
}
}
selectTemplateType
(
item
,
e
l
,
e
)
{
selectTemplateType
(
item
,
e
)
{
if
(
e
)
{
if
(
e
)
{
e
.
preventDefault
();
e
.
preventDefault
();
}
}
...
@@ -117,6 +117,10 @@ export default class FileTemplateMediator {
...
@@ -117,6 +117,10 @@ export default class FileTemplateMediator {
this
.
cacheToggleText
();
this
.
cacheToggleText
();
}
}
selectTemplateTypeOptions
(
options
)
{
this
.
selectTemplateType
(
options
.
selectedObj
,
options
.
e
);
}
selectTemplateFile
(
selector
,
query
,
data
)
{
selectTemplateFile
(
selector
,
query
,
data
)
{
selector
.
renderLoading
();
selector
.
renderLoading
();
// in case undo menu is already already there
// in case undo menu is already already there
...
...
app/assets/javascripts/blob/file_template_selector.js
View file @
519f35e4
...
@@ -52,9 +52,18 @@ export default class FileTemplateSelector {
...
@@ -52,9 +52,18 @@ export default class FileTemplateSelector {
.
removeClass
(
'
fa-spinner fa-spin
'
);
.
removeClass
(
'
fa-spinner fa-spin
'
);
}
}
reportSelection
(
query
,
el
,
e
,
data
)
{
reportSelection
(
options
)
{
const
{
query
,
e
,
data
}
=
options
;
e
.
preventDefault
();
e
.
preventDefault
();
return
this
.
mediator
.
selectTemplateFile
(
this
,
query
,
data
);
return
this
.
mediator
.
selectTemplateFile
(
this
,
query
,
data
);
}
}
reportSelectionName
(
options
)
{
const
opts
=
options
;
opts
.
query
=
options
.
selectedObj
.
name
;
this
.
reportSelection
(
opts
);
}
}
}
app/assets/javascripts/blob/template_selectors/ci_yaml_selector.js
View file @
519f35e4
...
@@ -25,7 +25,7 @@ export default class BlobCiYamlSelector extends FileTemplateSelector {
...
@@ -25,7 +25,7 @@ export default class BlobCiYamlSelector extends FileTemplateSelector {
search
:
{
search
:
{
fields
:
[
'
name
'
],
fields
:
[
'
name
'
],
},
},
clicked
:
(
query
,
el
,
e
)
=>
this
.
reportSelection
(
query
.
name
,
el
,
e
),
clicked
:
options
=>
this
.
reportSelectionName
(
options
),
text
:
item
=>
item
.
name
,
text
:
item
=>
item
.
name
,
});
});
}
}
...
...
app/assets/javascripts/blob/template_selectors/dockerfile_selector.js
View file @
519f35e4
...
@@ -25,7 +25,7 @@ export default class DockerfileSelector extends FileTemplateSelector {
...
@@ -25,7 +25,7 @@ export default class DockerfileSelector extends FileTemplateSelector {
search: {
search: {
fields: ['name'],
fields: ['name'],
},
},
clicked:
(query, el, e) => this.reportSelection(query.name, el, e
),
clicked:
options => this.reportSelectionName(options
),
text: item => item.name,
text: item => item.name,
});
});
}
}
...
...
app/assets/javascripts/blob/template_selectors/gitignore_selector.js
View file @
519f35e4
...
@@ -24,7 +24,7 @@ export default class BlobGitignoreSelector extends FileTemplateSelector {
...
@@ -24,7 +24,7 @@ export default class BlobGitignoreSelector extends FileTemplateSelector {
search
:
{
search
:
{
fields
:
[
'
name
'
],
fields
:
[
'
name
'
],
},
},
clicked
:
(
query
,
el
,
e
)
=>
this
.
reportSelection
(
query
.
name
,
el
,
e
),
clicked
:
options
=>
this
.
reportSelectionName
(
options
),
text
:
item
=>
item
.
name
,
text
:
item
=>
item
.
name
,
});
});
}
}
...
...
app/assets/javascripts/blob/template_selectors/license_selector.js
View file @
519f35e4
...
@@ -24,13 +24,22 @@ export default class BlobLicenseSelector extends FileTemplateSelector {
...
@@ -24,13 +24,22 @@ export default class BlobLicenseSelector extends FileTemplateSelector {
search
:
{
search
:
{
fields
:
[
'
name
'
],
fields
:
[
'
name
'
],
},
},
clicked
:
(
query
,
el
,
e
)
=>
{
clicked
:
(
options
)
=>
{
const
{
e
}
=
options
;
const
el
=
options
.
$el
;
const
query
=
options
.
selectedObj
;
const
data
=
{
const
data
=
{
project
:
this
.
$dropdown
.
data
(
'
project
'
),
project
:
this
.
$dropdown
.
data
(
'
project
'
),
fullname
:
this
.
$dropdown
.
data
(
'
fullname
'
),
fullname
:
this
.
$dropdown
.
data
(
'
fullname
'
),
};
};
this
.
reportSelection
(
query
.
id
,
el
,
e
,
data
);
this
.
reportSelection
({
query
:
query
.
id
,
el
,
e
,
data
,
});
},
},
text
:
item
=>
item
.
name
,
text
:
item
=>
item
.
name
,
});
});
...
...
app/assets/javascripts/blob/template_selectors/type_selector.js
View file @
519f35e4
...
@@ -17,7 +17,7 @@ export default class FileTemplateTypeSelector extends FileTemplateSelector {
...
@@ -17,7 +17,7 @@ export default class FileTemplateTypeSelector extends FileTemplateSelector {
filterable
:
false
,
filterable
:
false
,
selectable
:
true
,
selectable
:
true
,
toggleLabel
:
item
=>
item
.
name
,
toggleLabel
:
item
=>
item
.
name
,
clicked
:
(
item
,
el
,
e
)
=>
this
.
mediator
.
selectTemplateType
(
item
,
el
,
e
),
clicked
:
options
=>
this
.
mediator
.
selectTemplateTypeOptions
(
options
),
text
:
item
=>
item
.
name
,
text
:
item
=>
item
.
name
,
});
});
}
}
...
...
app/assets/javascripts/protected_tags/protected_tag_access_dropdown.js
View file @
519f35e4
...
@@ -17,8 +17,8 @@ export default class ProtectedTagAccessDropdown {
...
@@ -17,8 +17,8 @@ export default class ProtectedTagAccessDropdown {
}
}
return
'
Select
'
;
return
'
Select
'
;
},
},
clicked
(
item
,
$el
,
e
)
{
clicked
(
options
)
{
e
.
preventDefault
();
options
.
e
.
preventDefault
();
onSelect
();
onSelect
();
},
},
});
});
...
...
app/assets/javascripts/protected_tags/protected_tag_dropdown.js
View file @
519f35e4
...
@@ -39,8 +39,8 @@ export default class ProtectedTagDropdown {
...
@@ -39,8 +39,8 @@ export default class ProtectedTagDropdown {
return
_
.
escape
(
protectedTag
.
id
);
return
_
.
escape
(
protectedTag
.
id
);
},
},
onFilter
:
this
.
toggleCreateNewButton
.
bind
(
this
),
onFilter
:
this
.
toggleCreateNewButton
.
bind
(
this
),
clicked
:
(
item
,
$el
,
e
)
=>
{
clicked
:
(
options
)
=>
{
e
.
preventDefault
();
options
.
e
.
preventDefault
();
this
.
onSelect
();
this
.
onSelect
();
},
},
});
});
...
...
app/assets/javascripts/users_select.js
View file @
519f35e4
...
@@ -75,7 +75,11 @@ import eventHub from './sidebar/event_hub';
...
@@ -75,7 +75,11 @@ import eventHub from './sidebar/event_hub';
input
.
value
=
_this
.
currentUser
.
id
;
input
.
value
=
_this
.
currentUser
.
id
;
}
}
$dropdown
.
before
(
input
);
if
(
$selectbox
)
{
$dropdown
.
parent
().
before
(
input
);
}
else
{
$dropdown
.
after
(
input
);
}
};
};
if
(
$block
[
0
])
{
if
(
$block
[
0
])
{
...
@@ -93,6 +97,24 @@ import eventHub from './sidebar/event_hub';
...
@@ -93,6 +97,24 @@ import eventHub from './sidebar/event_hub';
.
get
();
.
get
();
};
};
const
checkMaxSelect
=
function
()
{
const
maxSelect
=
$dropdown
.
data
(
'
max-select
'
);
if
(
maxSelect
)
{
const
selected
=
getSelected
();
if
(
selected
.
length
>
maxSelect
)
{
const
firstSelectedId
=
selected
[
0
];
const
firstSelected
=
$dropdown
.
closest
(
'
.selectbox
'
)
.
find
(
`input[name='
${
$dropdown
.
data
(
'
field-name
'
)}
'][value=
${
firstSelectedId
}
]`
);
firstSelected
.
remove
();
eventHub
.
$emit
(
'
sidebar.removeAssignee
'
,
{
id
:
firstSelectedId
,
});
}
}
};
const
getMultiSelectDropdownTitle
=
function
(
selectedUser
,
isSelected
)
{
const
getMultiSelectDropdownTitle
=
function
(
selectedUser
,
isSelected
)
{
const
selectedUsers
=
getSelected
()
const
selectedUsers
=
getSelected
()
.
filter
(
u
=>
u
!==
0
);
.
filter
(
u
=>
u
!==
0
);
...
@@ -123,6 +145,7 @@ import eventHub from './sidebar/event_hub';
...
@@ -123,6 +145,7 @@ import eventHub from './sidebar/event_hub';
if
(
$dropdown
.
data
(
'
multiSelect
'
))
{
if
(
$dropdown
.
data
(
'
multiSelect
'
))
{
assignYourself
();
assignYourself
();
checkMaxSelect
();
const
currentUserInfo
=
$dropdown
.
data
(
'
currentUserInfo
'
);
const
currentUserInfo
=
$dropdown
.
data
(
'
currentUserInfo
'
);
$dropdown
.
find
(
'
.dropdown-toggle-text
'
).
text
(
getMultiSelectDropdownTitle
(
currentUserInfo
)).
removeClass
(
'
is-default
'
);
$dropdown
.
find
(
'
.dropdown-toggle-text
'
).
text
(
getMultiSelectDropdownTitle
(
currentUserInfo
)).
removeClass
(
'
is-default
'
);
...
@@ -329,21 +352,7 @@ import eventHub from './sidebar/event_hub';
...
@@ -329,21 +352,7 @@ import eventHub from './sidebar/event_hub';
// Enables support for limiting the number of users selected
// Enables support for limiting the number of users selected
// Automatically removes the first on the list if more users are selected
// Automatically removes the first on the list if more users are selected
const
maxSelect
=
$dropdown
.
data
(
'
max-select
'
);
checkMaxSelect
();
if
(
maxSelect
)
{
const
selected
=
getSelected
();
if
(
selected
.
length
>
maxSelect
)
{
const
firstSelectedId
=
selected
[
0
];
const
firstSelected
=
$dropdown
.
closest
(
'
.selectbox
'
)
.
find
(
`input[name='
${
$dropdown
.
data
(
'
field-name
'
)}
'][value=
${
firstSelectedId
}
]`
);
firstSelected
.
remove
();
eventHub
.
$emit
(
'
sidebar.removeAssignee
'
,
{
id
:
firstSelectedId
,
});
}
}
if
(
user
.
beforeDivider
&&
user
.
name
.
toLowerCase
()
===
'
unassigned
'
)
{
if
(
user
.
beforeDivider
&&
user
.
name
.
toLowerCase
()
===
'
unassigned
'
)
{
// Unassigned selected
// Unassigned selected
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
519f35e4
...
@@ -257,6 +257,10 @@
...
@@ -257,6 +257,10 @@
padding
:
0
16px
;
padding
:
0
16px
;
}
}
&
.capitalize-header
.dropdown-header
{
text-transform
:
capitalize
;
}
.separator
+
.dropdown-header
{
.separator
+
.dropdown-header
{
padding-top
:
2px
;
padding-top
:
2px
;
}
}
...
...
app/helpers/form_helper.rb
View file @
519f35e4
...
@@ -18,7 +18,7 @@ module FormHelper
...
@@ -18,7 +18,7 @@ module FormHelper
def
issue_dropdown_options
(
issuable
,
has_multiple_assignees
=
true
)
def
issue_dropdown_options
(
issuable
,
has_multiple_assignees
=
true
)
options
=
{
options
=
{
toggle_class:
'js-user-search js-assignee-search'
,
toggle_class:
'js-user-search js-assignee-search
js-multiselect js-save-user-data
'
,
title:
'Select assignee'
,
title:
'Select assignee'
,
filter:
true
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee'
,
...
@@ -32,16 +32,15 @@ module FormHelper
...
@@ -32,16 +32,15 @@ module FormHelper
default_label:
'Assignee'
,
default_label:
'Assignee'
,
'max-select'
:
1
,
'max-select'
:
1
,
'dropdown-header'
:
'Assignee'
,
'dropdown-header'
:
'Assignee'
,
multi_select:
true
,
'input-meta'
:
'name'
,
'always-show-selectbox'
:
true
,
current_user_info:
current_user
.
to_json
(
only:
[
:id
,
:name
])
}
}
}
}
if
has_multiple_assignees
if
has_multiple_assignees
options
[
:toggle_class
]
+=
' js-multiselect js-save-user-data'
options
[
:title
]
=
'Select assignee(s)'
options
[
:title
]
=
'Select assignee(s)'
options
[
:data
][
:multi_select
]
=
true
options
[
:data
][
:'input-meta'
]
=
'name'
options
[
:data
][
:'always-show-selectbox'
]
=
true
options
[
:data
][
:current_user_info
]
=
current_user
.
to_json
(
only:
[
:id
,
:name
])
options
[
:data
][
:'dropdown-header'
]
=
'Assignee(s)'
options
[
:data
][
:'dropdown-header'
]
=
'Assignee(s)'
options
[
:data
].
delete
(
:'max-select'
)
options
[
:data
].
delete
(
:'max-select'
)
end
end
...
...
app/views/projects/protected_branches/_create_protected_branch.html.haml
View file @
519f35e4
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
.merge_access_levels-container
.merge_access_levels-container
=
dropdown_tag
(
'Select'
,
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-merge js-multiselect wide'
,
options:
{
toggle_class:
'js-allowed-to-merge js-multiselect wide'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable
capitalize-header
'
,
filter:
true
,
data:
{
input_id:
'merge_access_levels_attributes'
,
default_label:
'Select'
}
})
data:
{
input_id:
'merge_access_levels_attributes'
,
default_label:
'Select'
}
})
.form-group
.form-group
%label
.col-md-2.text-right
{
for:
'push_access_levels_attributes'
}
%label
.col-md-2.text-right
{
for:
'push_access_levels_attributes'
}
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
.push_access_levels-container
.push_access_levels-container
=
dropdown_tag
(
'Select'
,
=
dropdown_tag
(
'Select'
,
options:
{
toggle_class:
'js-allowed-to-push js-multiselect wide'
,
options:
{
toggle_class:
'js-allowed-to-push js-multiselect wide'
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable
capitalize-header
'
,
filter:
true
,
data:
{
input_id:
'push_access_levels_attributes'
,
default_label:
'Select'
}
})
data:
{
input_id:
'push_access_levels_attributes'
,
default_label:
'Select'
}
})
.help-block
.help-block
Only groups that
Only groups that
...
...
app/views/projects/protected_branches/_update_protected_branch.html.haml
View file @
519f35e4
%td
%td
=
hidden_field_tag
"allowed_to_merge_
#{
protected_branch
.
id
}
"
,
protected_branch
.
merge_access_levels
.
first
.
access_level
=
hidden_field_tag
"allowed_to_merge_
#{
protected_branch
.
id
}
"
,
protected_branch
.
merge_access_levels
.
first
.
access_level
=
dropdown_tag
(
(
protected_branch
.
merge_access_levels
.
first
.
humanize
||
'Select'
)
,
=
dropdown_tag
(
(
protected_branch
.
merge_access_levels
.
first
.
humanize
||
'Select'
)
,
options:
{
toggle_class:
'js-allowed-to-merge'
,
dropdown_class:
'dropdown-menu-selectable js-allowed-to-merge-container'
,
options:
{
toggle_class:
'js-allowed-to-merge'
,
dropdown_class:
'dropdown-menu-selectable js-allowed-to-merge-container
capitalize-header
'
,
data:
{
field_name:
"allowed_to_merge_
#{
protected_branch
.
id
}
"
,
access_level_id:
protected_branch
.
merge_access_levels
.
first
.
id
}})
data:
{
field_name:
"allowed_to_merge_
#{
protected_branch
.
id
}
"
,
access_level_id:
protected_branch
.
merge_access_levels
.
first
.
id
}})
%td
%td
=
hidden_field_tag
"allowed_to_push_
#{
protected_branch
.
id
}
"
,
protected_branch
.
push_access_levels
.
first
.
access_level
=
hidden_field_tag
"allowed_to_push_
#{
protected_branch
.
id
}
"
,
protected_branch
.
push_access_levels
.
first
.
access_level
=
dropdown_tag
(
(
protected_branch
.
push_access_levels
.
first
.
humanize
||
'Select'
)
,
=
dropdown_tag
(
(
protected_branch
.
push_access_levels
.
first
.
humanize
||
'Select'
)
,
options:
{
toggle_class:
'js-allowed-to-push'
,
dropdown_class:
'dropdown-menu-selectable js-allowed-to-push-container'
,
options:
{
toggle_class:
'js-allowed-to-push'
,
dropdown_class:
'dropdown-menu-selectable js-allowed-to-push-container
capitalize-header
'
,
data:
{
field_name:
"allowed_to_push_
#{
protected_branch
.
id
}
"
,
access_level_id:
protected_branch
.
push_access_levels
.
first
.
id
}})
data:
{
field_name:
"allowed_to_push_
#{
protected_branch
.
id
}
"
,
access_level_id:
protected_branch
.
push_access_levels
.
first
.
id
}})
app/views/projects/protected_tags/_dropdown.html.haml
View file @
519f35e4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
=
dropdown_tag
(
'Select tag or create wildcard'
,
=
dropdown_tag
(
'Select tag or create wildcard'
,
options:
{
toggle_class:
'js-protected-tag-select js-filter-submit wide'
,
options:
{
toggle_class:
'js-protected-tag-select js-filter-submit wide'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
placeholder:
"Search protected tag"
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable
capitalize-header
"
,
placeholder:
"Search protected tag"
,
footer_content:
true
,
footer_content:
true
,
data:
{
show_no:
true
,
show_any:
true
,
show_upcoming:
true
,
data:
{
show_no:
true
,
show_any:
true
,
show_upcoming:
true
,
selected:
params
[
:protected_tag_name
],
selected:
params
[
:protected_tag_name
],
...
...
app/views/projects/protected_tags/_update_protected_tag.haml
View file @
519f35e4
%td
%td
=
hidden_field_tag
"allowed_to_create_
#{
protected_tag
.
id
}
"
,
protected_tag
.
create_access_levels
.
first
.
access_level
=
hidden_field_tag
"allowed_to_create_
#{
protected_tag
.
id
}
"
,
protected_tag
.
create_access_levels
.
first
.
access_level
=
dropdown_tag
(
(
protected_tag
.
create_access_levels
.
first
.
humanize
||
'Select'
)
,
=
dropdown_tag
(
(
protected_tag
.
create_access_levels
.
first
.
humanize
||
'Select'
)
,
options:
{
toggle_class:
'js-allowed-to-create'
,
dropdown_class:
'dropdown-menu-selectable js-allowed-to-create-container'
,
options:
{
toggle_class:
'js-allowed-to-create'
,
dropdown_class:
'dropdown-menu-selectable
capitalize-header
js-allowed-to-create-container'
,
data:
{
field_name:
"allowed_to_create_
#{
protected_tag
.
id
}
"
,
access_level_id:
protected_tag
.
create_access_levels
.
first
.
id
}})
data:
{
field_name:
"allowed_to_create_
#{
protected_tag
.
id
}
"
,
access_level_id:
protected_tag
.
create_access_levels
.
first
.
id
}})
app/views/shared/issuable/form/_metadata.html.haml
View file @
519f35e4
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
-
issuable
.
assignees
.
each
do
|
assignee
|
-
issuable
.
assignees
.
each
do
|
assignee
|
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
,
data:
{
meta:
assignee
.
name
}
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
assignee
.
id
,
id:
nil
,
data:
{
meta:
assignee
.
name
}
-
if
issuable
.
assignees
.
length
===
0
=
hidden_field_tag
"
#{
issuable
.
to_ability_name
}
[assignee_ids][]"
,
0
,
id:
nil
,
data:
{
meta:
''
}
=
dropdown_tag
(
users_dropdown_label
(
issuable
.
assignees
),
options:
issue_dropdown_options
(
issuable
,
true
))
=
dropdown_tag
(
users_dropdown_label
(
issuable
.
assignees
),
options:
issue_dropdown_options
(
issuable
,
true
))
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignees
.
include?
(
current_user
)
}
"
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignees
.
include?
(
current_user
)
}
"
-
else
-
else
...
...
spec/policies/issue_policy_spec.rb
View file @
519f35e4
...
@@ -15,7 +15,7 @@ describe IssuePolicy, models: true do
...
@@ -15,7 +15,7 @@ describe IssuePolicy, models: true do
context
'a private project'
do
context
'a private project'
do
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:non_member
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
:private
)
}
let
(
:project
)
{
create
(
:empty_project
,
:private
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee
:
assignee
,
author:
author
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee
s:
[
assignee
]
,
author:
author
)
}
let
(
:issue_no_assignee
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue_no_assignee
)
{
create
(
:issue
,
project:
project
)
}
before
do
before
do
...
@@ -69,7 +69,7 @@ describe IssuePolicy, models: true do
...
@@ -69,7 +69,7 @@ describe IssuePolicy, models: true do
end
end
context
'with confidential issues'
do
context
'with confidential issues'
do
let
(
:confidential_issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
assignee
:
assignee
,
author:
author
)
}
let
(
:confidential_issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
assignee
s:
[
assignee
]
,
author:
author
)
}
let
(
:confidential_issue_no_assignee
)
{
create
(
:issue
,
:confidential
,
project:
project
)
}
let
(
:confidential_issue_no_assignee
)
{
create
(
:issue
,
:confidential
,
project:
project
)
}
it
'does not allow non-members to read confidential issues'
do
it
'does not allow non-members to read confidential issues'
do
...
@@ -110,7 +110,7 @@ describe IssuePolicy, models: true do
...
@@ -110,7 +110,7 @@ describe IssuePolicy, models: true do
context
'a public project'
do
context
'a public project'
do
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee
:
assignee
,
author:
author
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee
s:
[
assignee
]
,
author:
author
)
}
let
(
:issue_no_assignee
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue_no_assignee
)
{
create
(
:issue
,
project:
project
)
}
before
do
before
do
...
@@ -157,7 +157,7 @@ describe IssuePolicy, models: true do
...
@@ -157,7 +157,7 @@ describe IssuePolicy, models: true do
end
end
context
'with confidential issues'
do
context
'with confidential issues'
do
let
(
:confidential_issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
assignee
:
assignee
,
author:
author
)
}
let
(
:confidential_issue
)
{
create
(
:issue
,
:confidential
,
project:
project
,
assignee
s:
[
assignee
]
,
author:
author
)
}
let
(
:confidential_issue_no_assignee
)
{
create
(
:issue
,
:confidential
,
project:
project
)
}
let
(
:confidential_issue_no_assignee
)
{
create
(
:issue
,
:confidential
,
project:
project
)
}
it
'does not allow guests to read confidential issues'
do
it
'does not allow guests to read confidential issues'
do
...
...
spec/services/members/authorized_destroy_service_spec.rb
View file @
519f35e4
...
@@ -14,8 +14,8 @@ describe Members::AuthorizedDestroyService, services: true do
...
@@ -14,8 +14,8 @@ describe Members::AuthorizedDestroyService, services: true do
it
"unassigns issues and merge requests"
do
it
"unassigns issues and merge requests"
do
group
.
add_developer
(
member_user
)
group
.
add_developer
(
member_user
)
issue
=
create
:issue
,
project:
group_project
,
assignee
:
member_user
issue
=
create
:issue
,
project:
group_project
,
assignee
s:
[
member_user
]
create
:issue
,
assignee
:
member_user
create
:issue
,
assignee
s:
[
member_user
]
merge_request
=
create
:merge_request
,
target_project:
group_project
,
source_project:
group_project
,
assignee:
member_user
merge_request
=
create
:merge_request
,
target_project:
group_project
,
source_project:
group_project
,
assignee:
member_user
create
:merge_request
,
target_project:
project
,
source_project:
project
,
assignee:
member_user
create
:merge_request
,
target_project:
project
,
source_project:
project
,
assignee:
member_user
...
@@ -33,7 +33,7 @@ describe Members::AuthorizedDestroyService, services: true do
...
@@ -33,7 +33,7 @@ describe Members::AuthorizedDestroyService, services: true do
it
"unassigns issues and merge requests"
do
it
"unassigns issues and merge requests"
do
project
.
team
<<
[
member_user
,
:developer
]
project
.
team
<<
[
member_user
,
:developer
]
create
:issue
,
project:
project
,
assignee
:
member_user
create
:issue
,
project:
project
,
assignee
s:
[
member_user
]
create
:merge_request
,
target_project:
project
,
source_project:
project
,
assignee:
member_user
create
:merge_request
,
target_project:
project
,
source_project:
project
,
assignee:
member_user
member
=
project
.
members
.
find_by
(
user_id:
member_user
.
id
)
member
=
project
.
members
.
find_by
(
user_id:
member_user
.
id
)
...
...
spec/services/users/destroy_service_spec.rb
View file @
519f35e4
...
@@ -47,7 +47,7 @@ describe Users::DestroyService, services: true do
...
@@ -47,7 +47,7 @@ describe Users::DestroyService, services: true do
end
end
context
"for an issue the user was assigned to"
do
context
"for an issue the user was assigned to"
do
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee
:
user
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
assignee
s:
[
user
]
)
}
before
do
before
do
service
.
execute
(
user
)
service
.
execute
(
user
)
...
@@ -60,7 +60,7 @@ describe Users::DestroyService, services: true do
...
@@ -60,7 +60,7 @@ describe Users::DestroyService, services: true do
it
'migrates the issue so that it is "Unassigned"'
do
it
'migrates the issue so that it is "Unassigned"'
do
migrated_issue
=
Issue
.
find_by_id
(
issue
.
id
)
migrated_issue
=
Issue
.
find_by_id
(
issue
.
id
)
expect
(
migrated_issue
.
assignee
).
to
be_nil
expect
(
migrated_issue
.
assignee
s
).
to
be_empty
end
end
end
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