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
3eacfdee
Commit
3eacfdee
authored
Apr 19, 2021
by
Natalia Tepluhina
Committed by
Nicolò Maria Mezzopera
Apr 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added feature flag to show/hide assignees GraphQL widget [RUN ALL RSPEC] [RUN AS-IF-FOSS]
parent
f9d574fb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
305 additions
and
117 deletions
+305
-117
app/assets/javascripts/invite_member/init_invite_member_modal.js
...ets/javascripts/invite_member/init_invite_member_modal.js
+4
-1
app/assets/javascripts/sidebar/mount_sidebar.js
app/assets/javascripts/sidebar/mount_sidebar.js
+4
-1
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-0
changelogs/unreleased/ntepluhina-assignees-feature-flag.yml
changelogs/unreleased/ntepluhina-assignees-feature-flag.yml
+5
-0
config/feature_flags/development/issue_assignees_widget.yml
config/feature_flags/development/issue_assignees_widget.yml
+8
-0
spec/features/issues/issue_sidebar_spec.rb
spec/features/issues/issue_sidebar_spec.rb
+150
-68
spec/features/issues/user_edits_issue_spec.rb
spec/features/issues/user_edits_issue_spec.rb
+133
-47
No files found.
app/assets/javascripts/invite_member/init_invite_member_modal.js
View file @
3eacfdee
...
...
@@ -5,10 +5,13 @@ import InviteMemberModal from './components/invite_member_modal.vue';
Vue
.
use
(
GlToast
);
const
isAssigneesWidgetShown
=
(
isInIssuePage
()
||
isInDesignPage
())
&&
gon
.
features
.
issueAssigneesWidget
;
export
default
function
initInviteMembersModal
()
{
const
el
=
document
.
querySelector
(
'
.js-invite-member-modal
'
);
if
(
!
el
||
is
InDesignPage
()
||
isInIssuePage
()
)
{
if
(
!
el
||
is
AssigneesWidgetShown
)
{
return
false
;
}
...
...
app/assets/javascripts/sidebar/mount_sidebar.js
View file @
3eacfdee
...
...
@@ -410,8 +410,11 @@ function mountCopyEmailComponent() {
});
}
const
isAssigneesWidgetShown
=
(
isInIssuePage
()
||
isInDesignPage
())
&&
gon
.
features
.
issueAssigneesWidget
;
export
function
mountSidebar
(
mediator
)
{
if
(
is
InIssuePage
()
||
isInDesignPage
()
)
{
if
(
is
AssigneesWidgetShown
)
{
mountAssigneesComponent
();
}
else
{
mountAssigneesComponentDeprecated
(
mediator
);
...
...
app/controllers/projects/issues_controller.rb
View file @
3eacfdee
...
...
@@ -54,6 +54,7 @@ class Projects::IssuesController < Projects::ApplicationController
push_to_gon_attributes
(
:features
,
real_time_feature_flag
,
real_time_enabled
)
push_frontend_feature_flag
(
:confidential_notes
,
@project
,
default_enabled: :yaml
)
push_frontend_feature_flag
(
:issue_assignees_widget
,
@project
,
default_enabled: :yaml
)
record_experiment_user
(
:invite_members_version_b
)
...
...
changelogs/unreleased/ntepluhina-assignees-feature-flag.yml
0 → 100644
View file @
3eacfdee
---
title
:
Added feature flag to show/hide assignees GraphQL widget
merge_request
:
59620
author
:
type
:
fixed
config/feature_flags/development/issue_assignees_widget.yml
0 → 100644
View file @
3eacfdee
---
name
:
issue_assignees_widget
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/59620/
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/328185
milestone
:
'
13.11'
type
:
development
group
:
group::project management
default_enabled
:
false
spec/features/issues/issue_sidebar_spec.rb
View file @
3eacfdee
...
...
@@ -30,116 +30,198 @@ RSpec.describe 'Issue Sidebar' do
let
(
:user2
)
{
create
(
:user
)
}
let
(
:issue2
)
{
create
(
:issue
,
project:
project
,
author:
user2
)
}
context
'when a privileged user can invite'
do
it
'shows a link for inviting members and launches invite modal'
do
project
.
add_maintainer
(
user
)
visit_issue
(
project
,
issue2
)
context
'when GraphQL assignees widget feature flag is disabled'
do
before
do
stub_feature_flags
(
issue_assignees_widget:
false
)
end
include_examples
'issuable invite members experiments'
do
let
(
:issuable_path
)
{
project_issue_path
(
project
,
issue2
)
}
end
open_assignees_dropdown
context
'when user is a developer'
do
before
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
find
(
'.block.assignee .edit-link'
).
click
wait_for_requests
end
page
.
within
'.dropdown-menu-user
'
do
expect
(
page
).
to
have_link
(
'Invite members'
)
expect
(
page
).
to
have_selector
(
'[data-track-event="click_invite_members"]'
)
e
xpect
(
page
).
to
have_selector
(
'[data-track-label="edit_assignee"]'
)
it
'shows author in assignee dropdown
'
do
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_content
(
user2
.
name
)
e
nd
end
click_link
'Invite members'
it
'shows author when filtering assignee dropdown'
do
page
.
within
'.dropdown-menu-user'
do
find
(
'.dropdown-input-field'
).
set
(
user2
.
name
)
expect
(
page
).
to
have_content
(
"You're inviting members to the"
)
end
end
wait_for_requests
context
'when invite_members_version_b experiment is enabled'
do
before
do
stub_experiment_for_subject
(
invite_members_version_b:
true
)
end
expect
(
page
).
to
have_content
(
user2
.
name
)
end
end
it
'assigns yourself'
do
find
(
'.block.assignee .dropdown-menu-toggle'
).
click
it
'shows a link for inviting members and follows through to modal'
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
click_button
'assign yourself'
open_assignees_dropdown
wait_for_requests
find
(
'.block.assignee .edit-link'
).
click
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_link
(
'Invite members'
,
href:
'#'
)
expect
(
page
).
to
have_selector
(
'[data-track-event="click_invite_members_version_b"]'
)
e
xpect
(
page
).
to
have_selector
(
'[data-track-label="edit_assignee"]'
)
page
.
within
'.dropdown-menu-user'
do
expect
(
page
.
find
(
'.dropdown-header'
)).
to
be_visible
expect
(
page
.
find
(
'.dropdown-menu-user-link.is-active'
)).
to
have_content
(
user
.
name
)
e
nd
end
click_link
'Invite members'
it
'keeps your filtered term after filtering and dismissing the dropdown'
do
find
(
'.dropdown-input-field'
).
set
(
user2
.
name
)
expect
(
page
).
to
have_content
(
"Oops, this feature isn't ready yet"
)
end
end
wait_for_requests
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
not_to
have_content
'Unassigned'
click_link
user2
.
name
end
context
'when invite_members_version_b experiment is disabled'
do
it
'shows author in assignee dropdown and no invite link'
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
find
(
'.js-right-sidebar'
).
click
find
(
'.block.assignee .edit-link'
).
click
open_assignees_dropdown
expect
(
page
.
all
(
'.dropdown-menu-user li'
).
length
).
to
eq
(
1
)
expect
(
find
(
'.dropdown-input-field'
).
value
).
to
eq
(
user2
.
name
)
end
it
'shows label text as "Apply" when assignees are changed'
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
find
(
'.block.assignee .edit-link'
).
click
wait_for_requests
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
not_to
have_link
(
'Invite members'
)
click_on
'Unassigned'
expect
(
page
).
to
have_link
(
'Apply'
)
end
end
end
context
'when user is a developer'
do
before
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
end
context
'when GraphQL assignees widget feature flag is enabled'
do
context
'when a privileged user can invite'
do
it
'shows a link for inviting members and launches invite modal'
do
project
.
add_maintainer
(
user
)
visit_issue
(
project
,
issue2
)
open_assignees_dropdown
it
'shows author in assignee dropdown'
do
open_assignees_dropdown
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_link
(
'Invite members'
)
expect
(
page
).
to
have_selector
(
'[data-track-event="click_invite_members"]'
)
expect
(
page
).
to
have_selector
(
'[data-track-label="edit_assignee"]'
)
end
click_link
'Invite members'
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_content
(
user2
.
name
)
expect
(
page
).
to
have_content
(
"You're inviting members to the"
)
end
end
it
'shows author when filtering assignee dropdown'
do
open_assignees_dropdown
context
'when invite_members_version_b experiment is enabled'
do
before
do
stub_experiment_for_subject
(
invite_members_version_b:
true
)
end
it
'shows a link for inviting members and follows through to modal'
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
page
.
within
'.dropdown-menu-user'
do
find
(
'.js-dropdown-input-field'
).
find
(
'input'
).
set
(
user2
.
name
)
open_assignees_dropdown
wait_for_requests
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_link
(
'Invite members'
,
href:
'#'
)
expect
(
page
).
to
have_selector
(
'[data-track-event="click_invite_members_version_b"]'
)
expect
(
page
).
to
have_selector
(
'[data-track-label="edit_assignee"]'
)
end
expect
(
page
).
to
have_content
(
user2
.
name
)
click_link
'Invite members'
expect
(
page
).
to
have_content
(
"Oops, this feature isn't ready yet"
)
end
end
it
'assigns yourself'
do
click_button
'assign yourself'
wait_for_requests
context
'when invite_members_version_b experiment is disabled'
do
it
'shows author in assignee dropdown and no invite link'
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
open_assignees_dropdown
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
(
user
.
name
)
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
not_to
have_link
(
'Invite members'
)
end
end
end
it
'keeps your filtered term after filtering and dismissing the dropdown'
do
open_assignees_dropdown
context
'when user is a developer'
do
before
do
project
.
add_developer
(
user
)
visit_issue
(
project
,
issue2
)
end
find
(
'.js-dropdown-input-field'
).
find
(
'input'
).
set
(
user2
.
name
)
wait_for_requests
it
'shows author in assignee dropdown'
do
open_assignees_dropdown
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
not_to
have_content
'Unassigned'
click_link
user2
.
name
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_content
(
user2
.
name
)
end
end
find
(
'.js-right-sidebar'
).
click
it
'shows author when filtering assignee dropdown'
do
open_assignees_dropdown
page
.
within
'.dropdown-menu-user'
do
find
(
'.js-dropdown-input-field'
).
find
(
'input'
).
set
(
user2
.
name
)
wait_for_requests
open_assignees_dropdown
expect
(
page
).
to
have_content
(
user2
.
name
)
end
end
it
'assigns yourself'
do
click_button
'assign yourself'
wait_for_requests
page
.
within
(
'.assignee'
)
do
expect
(
page
.
all
(
'[data-testid="selected-participant"]'
).
length
).
to
eq
(
1
)
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
(
user
.
name
)
end
end
expect
(
find
(
'.js-dropdown-input-field'
).
find
(
'input'
).
value
).
to
eq
(
user2
.
name
)
it
'keeps your filtered term after filtering and dismissing the dropdown'
do
open_assignees_dropdown
find
(
'.js-dropdown-input-field'
).
find
(
'input'
).
set
(
user2
.
name
)
wait_for_requests
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
not_to
have_content
'Unassigned'
click_link
user2
.
name
end
find
(
'.js-right-sidebar'
).
click
open_assignees_dropdown
page
.
within
(
'.assignee'
)
do
expect
(
page
.
all
(
'[data-testid="selected-participant"]'
).
length
).
to
eq
(
1
)
end
expect
(
find
(
'.js-dropdown-input-field'
).
find
(
'input'
).
value
).
to
eq
(
user2
.
name
)
end
end
end
end
...
...
spec/features/issues/user_edits_issue_spec.rb
View file @
3eacfdee
...
...
@@ -167,79 +167,165 @@ RSpec.describe "Issues > User edits issue", :js do
end
describe
'update assignee'
do
context
'by authorized user'
do
it
'allows user to select unassigned'
do
visit
project_issue_path
(
project
,
issue
)
context
'when GraphQL assignees widget feature flag is disabled'
do
before
do
stub_feature_flags
(
issue_assignees_widget:
false
)
end
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"
#{
user
.
name
}
"
context
'by authorized user'
do
def
close_dropdown_menu_if_visible
find
(
'.dropdown-menu-toggle'
,
visible: :all
).
tap
do
|
toggle
|
toggle
.
click
if
toggle
.
visible?
end
end
click_button
(
'Edit'
)
wait_for_requests
it
'allows user to select unassigned'
do
visit
project_issue_path
(
project
,
issue
)
find
(
'[data-testid="unassign"]'
).
click
find
(
'[data-testid="title"]'
).
click
wait_for_requests
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"
#{
user
.
name
}
"
click_link
'Edit'
click_link
'Unassigned'
first
(
'.title'
).
click
expect
(
page
).
to
have_content
'None - assign yourself'
expect
(
page
).
to
have_content
'None - assign yourself'
end
end
end
it
'allows user to select an assignee'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
)
visit
project_issue_path
(
project
,
issue2
)
it
'allows user to select an assignee'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
)
visit
project_issue_path
(
project
,
issue2
)
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"None"
click_button
(
'Edit'
)
wait_for_requests
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"None"
end
page
.
within
'.assignee'
do
click_link
'Edit'
end
page
.
within
'.dropdown-menu-user'
do
click_link
user
.
name
end
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
user
.
name
end
end
it
'allows user to unselect themselves'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
visit
project_issue_path
(
project
,
issue2
)
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
user
.
name
click_link
'Edit'
click_link
user
.
name
close_dropdown_menu_if_visible
page
.
within
'.value .assign-yourself'
do
expect
(
page
).
to
have_content
"None"
end
end
end
end
page
.
within
'.dropdown-menu-user'
do
click_link
user
.
name
context
'by unauthorized user'
do
let
(
:guest
)
{
create
(
:user
)
}
before
do
project
.
add_guest
(
guest
)
end
page
.
within
(
'.assignee'
)
do
find
(
'[data-testid="title"]'
).
click
wait_for_requests
it
'shows assignee text'
do
sign_out
(
:user
)
sign_in
(
guest
)
expect
(
page
).
to
have_content
user
.
name
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
issue
.
assignees
.
first
.
name
end
end
end
it
'allows user to unselect themselves'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
context
'when GraphQL assignees widget feature flag is enabled'
do
context
'by authorized user'
do
it
'allows user to select unassigned'
do
visit
project_issue_path
(
project
,
issue
)
visit
project_issue_path
(
project
,
issue2
)
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"
#{
user
.
name
}
"
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
user
.
name
click_button
(
'Edit'
)
wait_for_requests
click_button
(
'Edit'
)
wait_for_requests
click_link
user
.
name
find
(
'[data-testid="unassign"]'
).
click
find
(
'[data-testid="title"]'
).
click
wait_for_requests
find
(
'[data-testid="title"]'
).
click
wait_for_requests
expect
(
page
).
to
have_content
'None - assign yourself'
end
end
expect
(
page
).
to
have_content
"None"
it
'allows user to select an assignee'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
)
visit
project_issue_path
(
project
,
issue2
)
page
.
within
(
'.assignee'
)
do
expect
(
page
).
to
have_content
"None"
click_button
(
'Edit'
)
wait_for_requests
end
page
.
within
'.dropdown-menu-user'
do
click_link
user
.
name
end
page
.
within
(
'.assignee'
)
do
find
(
'[data-testid="title"]'
).
click
wait_for_requests
expect
(
page
).
to
have_content
user
.
name
end
end
end
end
context
'by unauthorized user
'
do
let
(
:guest
)
{
create
(
:user
)
}
it
'allows user to unselect themselves
'
do
issue2
=
create
(
:issue
,
project:
project
,
author:
user
,
assignees:
[
user
])
before
do
project
.
add_guest
(
guest
)
visit
project_issue_path
(
project
,
issue2
)
page
.
within
'.assignee'
do
expect
(
page
).
to
have_content
user
.
name
click_button
(
'Edit'
)
wait_for_requests
click_link
user
.
name
find
(
'[data-testid="title"]'
).
click
wait_for_requests
expect
(
page
).
to
have_content
"None"
end
end
end
it
'shows assignee text'
do
sign_out
(
:user
)
sign_in
(
guest
)
context
'by unauthorized user'
do
let
(
:guest
)
{
create
(
:user
)
}
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
issue
.
assignees
.
first
.
name
before
do
project
.
add_guest
(
guest
)
end
it
'shows assignee text'
do
sign_out
(
:user
)
sign_in
(
guest
)
visit
project_issue_path
(
project
,
issue
)
expect
(
page
).
to
have_content
issue
.
assignees
.
first
.
name
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