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
84755869
Commit
84755869
authored
May 27, 2021
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add source to invite modal calls
- for telemetry of who triggered an invite.
parent
43239d5a
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
51 additions
and
28 deletions
+51
-28
app/assets/javascripts/invite_members/components/invite_members_trigger.vue
...ipts/invite_members/components/invite_members_trigger.vue
+1
-2
app/assets/javascripts/sidebar/components/assignees/sidebar_assignees_widget.vue
...sidebar/components/assignees/sidebar_assignees_widget.vue
+1
-1
app/assets/javascripts/sidebar/components/assignees/sidebar_invite_members.vue
...s/sidebar/components/assignees/sidebar_invite_members.vue
+12
-0
app/views/groups/group_members/index.html.haml
app/views/groups/group_members/index.html.haml
+4
-1
app/views/projects/project_members/index.html.haml
app/views/projects/project_members/index.html.haml
+4
-1
app/views/shared/issuable/_sidebar_assignees.html.haml
app/views/shared/issuable/_sidebar_assignees.html.haml
+2
-1
app/views/shared/issuable/_sidebar_reviewers.html.haml
app/views/shared/issuable/_sidebar_reviewers.html.haml
+2
-1
app/views/shared/issuable/_sidebar_user_dropdown.html.haml
app/views/shared/issuable/_sidebar_user_dropdown.html.haml
+1
-0
lib/api/invitations.rb
lib/api/invitations.rb
+1
-1
lib/api/members.rb
lib/api/members.rb
+1
-1
spec/features/groups/members/manage_members_spec.rb
spec/features/groups/members/manage_members_spec.rb
+2
-2
spec/features/projects/members/list_spec.rb
spec/features/projects/members/list_spec.rb
+2
-2
spec/frontend/invite_members/components/invite_members_trigger_spec.js
.../invite_members/components/invite_members_trigger_spec.js
+5
-11
spec/frontend/sidebar/components/assignees/sidebar_invite_members_spec.js
...debar/components/assignees/sidebar_invite_members_spec.js
+10
-1
spec/requests/api/invitations_spec.rb
spec/requests/api/invitations_spec.rb
+1
-1
spec/requests/api/members_spec.rb
spec/requests/api/members_spec.rb
+2
-2
No files found.
app/assets/javascripts/invite_members/components/invite_members_trigger.vue
View file @
84755869
...
...
@@ -29,8 +29,7 @@ export default {
},
triggerSource
:
{
type
:
String
,
required
:
false
,
default
:
'
unknown
'
,
required
:
true
,
},
trackExperiment
:
{
type
:
String
,
...
...
app/assets/javascripts/sidebar/components/assignees/sidebar_assignees_widget.vue
View file @
84755869
...
...
@@ -248,7 +248,7 @@ export default {
>
<template
#footer
>
<gl-dropdown-item
v-if=
"directlyInviteMembers"
>
<sidebar-invite-members
/>
<sidebar-invite-members
:issuable-type=
"issuableType"
/>
</gl-dropdown-item>
</
template
></user-select>
</template>
...
...
app/assets/javascripts/sidebar/components/assignees/sidebar_invite_members.vue
View file @
84755869
...
...
@@ -9,6 +9,17 @@ export default {
components
:
{
InviteMembersTrigger
,
},
props
:
{
issuableType
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
triggerSource
()
{
return
`
${
this
.
issuableType
}
-assignee-dropdown`
;
},
},
};
</
script
>
...
...
@@ -18,6 +29,7 @@ export default {
:display-text=
"$options.displayText"
:event=
"$options.dataTrackEvent"
:label=
"$options.dataTrackLabel"
:trigger-source=
"triggerSource"
classes=
"gl-display-block gl-pl-6 gl-hover-text-decoration-none gl-hover-text-blue-800!"
/>
</
template
>
app/views/groups/group_members/index.html.haml
View file @
84755869
...
...
@@ -15,7 +15,10 @@
.gl-w-half.gl-xs-w-full
.gl-display-flex.gl-flex-wrap.gl-justify-content-end.gl-mb-3
.js-invite-group-trigger
{
data:
{
classes:
'gl-mt-3 gl-sm-w-auto gl-w-full'
,
display_text:
_
(
'Invite a group'
)
}
}
.js-invite-members-trigger
{
data:
{
variant:
'success'
,
classes:
'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3'
,
display_text:
_
(
'Invite members'
)
}
}
.js-invite-members-trigger
{
data:
{
variant:
'success'
,
classes:
'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3'
,
trigger_source:
'group-members-page'
,
display_text:
_
(
'Invite members'
)
}
}
=
render
'groups/invite_members_modal'
,
group:
@group
-
if
can_manage_members?
&&
Feature
.
disabled?
(
:invite_members_group_modal
,
@group
)
%hr
.gl-mt-4
...
...
app/views/projects/project_members/index.html.haml
View file @
84755869
...
...
@@ -26,7 +26,10 @@
-
if
@project
.
allowed_to_share_with_group?
.js-invite-group-trigger
{
data:
{
classes:
'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3'
,
display_text:
_
(
'Invite a group'
)
}
}
-
if
can_manage_project_members?
(
@project
)
&&
!
membership_locked?
.js-invite-members-trigger
{
data:
{
variant:
'success'
,
classes:
'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3'
,
display_text:
_
(
'Invite members'
)
}
}
.js-invite-members-trigger
{
data:
{
variant:
'success'
,
classes:
'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3'
,
trigger_source:
'project-members-page'
,
display_text:
_
(
'Invite members'
)
}
}
=
render
'projects/invite_members_modal'
,
project:
@project
-
else
...
...
app/views/shared/issuable/_sidebar_assignees.html.haml
View file @
84755869
...
...
@@ -45,4 +45,5 @@
=
render
'shared/issuable/sidebar_user_dropdown'
,
options:
options
,
wrapper_class:
'js-sidebar-assignee-dropdown'
,
track_label:
'edit_assignee'
track_label:
'edit_assignee'
,
trigger_source:
"
#{
issuable_type
}
-assignee-dropdown"
app/views/shared/issuable/_sidebar_reviewers.html.haml
View file @
84755869
...
...
@@ -42,4 +42,5 @@
=
render
'shared/issuable/sidebar_user_dropdown'
,
options:
options
,
wrapper_class:
'js-sidebar-reviewer-dropdown'
,
track_label:
'edit_reviewer'
track_label:
'edit_reviewer'
,
trigger_source:
"
#{
issuable_type
}
-reviewer-dropdown"
app/views/shared/issuable/_sidebar_user_dropdown.html.haml
View file @
84755869
...
...
@@ -15,6 +15,7 @@
.js-invite-members-trigger
{
data:
{
trigger_element:
'anchor'
,
display_text:
_
(
'Invite Members'
),
event:
'click_invite_members'
,
trigger_source:
local_assigns
.
fetch
(
:trigger_source
),
label:
data
[
'track-label'
]
}
}
-
else
=
dropdown_tag
(
data
[
'dropdown-title'
],
options:
options
)
lib/api/invitations.rb
View file @
84755869
...
...
@@ -23,7 +23,7 @@ module API
requires
:email
,
types:
[
String
,
Array
[
String
]],
email_or_email_list:
true
,
desc:
'The email address to invite, or multiple emails separated by comma'
requires
:access_level
,
type:
Integer
,
values:
Gitlab
::
Access
.
all_values
,
desc:
'A valid access level (defaults: `30`, developer access level)'
optional
:expires_at
,
type:
DateTime
,
desc:
'Date string in the format YEAR-MONTH-DAY'
optional
:invite_source
,
type:
String
,
desc:
'Source that triggered the member creation process'
,
default:
'api'
optional
:invite_source
,
type:
String
,
desc:
'Source that triggered the member creation process'
,
default:
'
invitations-
api'
end
post
":id/invitations"
do
params
[
:source
]
=
find_source
(
source_type
,
params
[
:id
])
...
...
lib/api/members.rb
View file @
84755869
...
...
@@ -93,7 +93,7 @@ module API
requires
:access_level
,
type:
Integer
,
desc:
'A valid access level (defaults: `30`, developer access level)'
requires
:user_id
,
types:
[
Integer
,
String
],
desc:
'The user ID of the new member or multiple IDs separated by commas.'
optional
:expires_at
,
type:
DateTime
,
desc:
'Date string in the format YEAR-MONTH-DAY'
optional
:invite_source
,
type:
String
,
desc:
'Source that triggered the member creation process'
,
default:
'api'
optional
:invite_source
,
type:
String
,
desc:
'Source that triggered the member creation process'
,
default:
'
members-
api'
end
# rubocop: disable CodeReuse/ActiveRecord
post
":id/members"
do
...
...
spec/features/groups/members/manage_members_spec.rb
View file @
84755869
...
...
@@ -80,7 +80,7 @@ RSpec.describe 'Groups > Members > Manage members' do
expect_snowplow_event
(
category:
'Members::CreateService'
,
action:
'create_member'
,
label:
'
unknown
'
,
label:
'
group-members-page
'
,
property:
'existing_user'
,
user:
user1
)
...
...
@@ -189,7 +189,7 @@ RSpec.describe 'Groups > Members > Manage members' do
expect_snowplow_event
(
category:
'Members::InviteService'
,
action:
'create_member'
,
label:
'
unknown
'
,
label:
'
group-members-page
'
,
property:
'net_new_user'
,
user:
user1
)
...
...
spec/features/projects/members/list_spec.rb
View file @
84755869
...
...
@@ -59,7 +59,7 @@ RSpec.describe 'Project members list', :js do
expect_snowplow_event
(
category:
'Members::CreateService'
,
action:
'create_member'
,
label:
'
unknown
'
,
label:
'
project-members-page
'
,
property:
'existing_user'
,
user:
user1
)
...
...
@@ -117,7 +117,7 @@ RSpec.describe 'Project members list', :js do
expect_snowplow_event
(
category:
'Members::InviteService'
,
action:
'create_member'
,
label:
'
unknown
'
,
label:
'
project-members-page
'
,
property:
'net_new_user'
,
user:
user1
)
...
...
spec/frontend/invite_members/components/invite_members_trigger_spec.js
View file @
84755869
...
...
@@ -7,6 +7,8 @@ import eventHub from '~/invite_members/event_hub';
jest
.
mock
(
'
~/experimentation/experiment_tracking
'
);
const
displayText
=
'
Invite team members
'
;
const
triggerSource
=
'
_trigger_source_
'
;
let
wrapper
;
let
triggerProps
;
let
findButton
;
...
...
@@ -26,7 +28,7 @@ const createComponent = (props = {}) => {
};
describe
.
each
([
'
button
'
,
'
anchor
'
])(
'
with triggerElement as %s
'
,
(
triggerElement
)
=>
{
triggerProps
=
{
triggerElement
};
triggerProps
=
{
triggerElement
,
triggerSource
};
findButton
=
()
=>
wrapper
.
findComponent
(
triggerComponent
[
triggerElement
]);
afterEach
(()
=>
{
...
...
@@ -48,22 +50,14 @@ describe.each(['button', 'anchor'])('with triggerElement as %s', (triggerElement
spy
=
jest
.
spyOn
(
eventHub
,
'
$emit
'
);
});
it
(
'
emits openModal from an unknown source
'
,
()
=>
{
createComponent
();
findButton
().
vm
.
$emit
(
'
click
'
);
expect
(
spy
).
toHaveBeenCalledWith
(
'
openModal
'
,
{
inviteeType
:
'
members
'
,
source
:
'
unknown
'
});
});
it
(
'
emits openModal from a named source
'
,
()
=>
{
createComponent
(
{
triggerSource
:
'
_trigger_source_
'
}
);
createComponent
();
findButton
().
vm
.
$emit
(
'
click
'
);
expect
(
spy
).
toHaveBeenCalledWith
(
'
openModal
'
,
{
inviteeType
:
'
members
'
,
source
:
'
_trigger_source_
'
,
source
:
triggerSource
,
});
});
});
...
...
spec/frontend/sidebar/components/assignees/sidebar_invite_members_spec.js
View file @
84755869
...
...
@@ -4,11 +4,16 @@ import SidebarInviteMembers from '~/sidebar/components/assignees/sidebar_invite_
describe
(
'
Sidebar invite members component
'
,
()
=>
{
let
wrapper
;
const
issuableType
=
'
issue
'
;
const
findDirectInviteLink
=
()
=>
wrapper
.
findComponent
(
InviteMembersTrigger
);
const
createComponent
=
()
=>
{
wrapper
=
shallowMount
(
SidebarInviteMembers
);
wrapper
=
shallowMount
(
SidebarInviteMembers
,
{
propsData
:
{
issuableType
,
},
});
};
afterEach
(()
=>
{
...
...
@@ -23,5 +28,9 @@ describe('Sidebar invite members component', () => {
it
(
'
renders a direct link to project members path
'
,
()
=>
{
expect
(
findDirectInviteLink
().
exists
()).
toBe
(
true
);
});
it
(
'
has expected attributes on the trigger
'
,
()
=>
{
expect
(
findDirectInviteLink
().
props
(
'
triggerSource
'
)).
toBe
(
'
issue-assignee-dropdown
'
);
});
});
});
spec/requests/api/invitations_spec.rb
View file @
84755869
...
...
@@ -161,7 +161,7 @@ RSpec.describe API::Invitations do
expect_snowplow_event
(
category:
'Members::InviteService'
,
action:
'create_member'
,
label:
'api'
,
label:
'
invitations-
api'
,
property:
'net_new_user'
,
user:
maintainer
)
...
...
spec/requests/api/members_spec.rb
View file @
84755869
...
...
@@ -265,7 +265,7 @@ RSpec.describe API::Members do
expect_snowplow_event
(
category:
'Members::CreateService'
,
action:
'create_member'
,
label:
'api'
,
label:
'
members-
api'
,
property:
'existing_user'
,
user:
maintainer
)
...
...
@@ -322,7 +322,7 @@ RSpec.describe API::Members do
expect_snowplow_event
(
category:
'Members::CreateService'
,
action:
'create_member'
,
label:
'api'
,
label:
'
members-
api'
,
property:
'existing_user'
,
user:
maintainer
)
...
...
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