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
511aef55
Commit
511aef55
authored
Apr 12, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return unique schedules for member user
Move changleog
parent
6b04c576
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
ee/app/serializers/ee/member_user_entity.rb
ee/app/serializers/ee/member_user_entity.rb
+4
-0
ee/changelogs/323627-add-members-oncall-schedule-data-to-helper.yml
...ogs/323627-add-members-oncall-schedule-data-to-helper.yml
+0
-0
ee/spec/serializers/member_user_entity_spec.rb
ee/spec/serializers/member_user_entity_spec.rb
+40
-0
No files found.
ee/app/serializers/ee/member_user_entity.rb
View file @
511aef55
...
...
@@ -8,6 +8,10 @@ module EE
unexpose
:gitlab_employee
unexpose
:email
expose
:oncall_schedules
,
with:
::
IncidentManagement
::
OncallScheduleEntity
def
oncall_schedules
object
.
oncall_schedules
.
uniq
end
end
end
end
changelogs/unreleased
/323627-add-members-oncall-schedule-data-to-helper.yml
→
ee/changelogs
/323627-add-members-oncall-schedule-data-to-helper.yml
View file @
511aef55
File moved
ee/spec/serializers/member_user_entity_spec.rb
0 → 100644
View file @
511aef55
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
MemberUserEntity
do
let_it_be_with_reload
(
:user
)
{
create
(
:user
)
}
let
(
:entity
)
{
described_class
.
new
(
user
)
}
let
(
:entity_hash
)
{
entity
.
as_json
}
it
'matches json schema'
do
expect
(
entity
.
to_json
).
to
match_schema
(
'entities/member_user'
)
end
context
'with oncall schedules'
do
let_it_be
(
:oncall_schedule
)
{
create
(
:incident_management_oncall_participant
,
user:
user
).
rotation
.
schedule
}
it
'correctly exposes `oncall_schedules`'
do
expect
(
entity_hash
[
:oncall_schedules
]).
to
include
(
schedule_hash
(
oncall_schedule
))
end
it
'exposed and de-dupes the schedules'
do
allow
(
user
).
to
receive
(
:oncall_schedules
).
and_return
([
oncall_schedule
,
oncall_schedule
])
expect
(
entity_hash
[
:oncall_schedules
].
size
).
to
eq
(
1
)
expect
(
entity_hash
[
:oncall_schedules
]).
to
include
(
schedule_hash
(
oncall_schedule
))
end
def
schedule_hash
(
schedule
)
schedule_url
=
Gitlab
::
Routing
.
url_helpers
.
project_incident_management_oncall_schedules_url
(
schedule
.
project
)
project_url
=
Gitlab
::
Routing
.
url_helpers
.
project_url
(
schedule
.
project
)
{
name:
oncall_schedule
.
name
,
project_name:
oncall_schedule
.
project
.
name
,
schedule_url:
schedule_url
,
project_url:
project_url
}
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