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
97330c56
Commit
97330c56
authored
Oct 22, 2019
by
allison.browne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix more specs related to zoom meeting persistance
parent
d66025dc
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
89 additions
and
88 deletions
+89
-88
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+1
-2
app/services/issues/zoom_link_service.rb
app/services/issues/zoom_link_service.rb
+2
-0
app/services/zoom_notes_service.rb
app/services/zoom_notes_service.rb
+3
-5
spec/features/issues/user_creates_issue_spec.rb
spec/features/issues/user_creates_issue_spec.rb
+0
-13
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+3
-7
spec/services/issues/zoom_link_service_spec.rb
spec/services/issues/zoom_link_service_spec.rb
+6
-12
spec/services/zoom_notes_service_spec.rb
spec/services/zoom_notes_service_spec.rb
+54
-25
spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb
...quick_actions/issue/zoom_quick_actions_shared_examples.rb
+19
-24
No files found.
app/services/issues/update_service.rb
View file @
97330c56
...
...
@@ -62,8 +62,7 @@ module Issues
notification_service
.
async
.
new_mentions_in_issue
(
issue
,
added_mentions
,
current_user
)
end
old_zoom_meetings
=
old_associations
.
fetch
(
:zoom_meetings
,
[])
ZoomNotesService
.
new
(
issue
,
project
,
current_user
,
old_zoom_meetings
).
execute
ZoomNotesService
.
new
(
issue
,
project
,
current_user
,
old_associations
).
execute
end
def
handle_task_changes
(
issuable
)
...
...
app/services/issues/zoom_link_service.rb
View file @
97330c56
...
...
@@ -60,12 +60,14 @@ module Issues
issue_status: :added
,
url:
link
)
track_meeting_added_event
issue
.
zoom_meetings
end
def
remove_zoom_meeting
@added_meeting
.
issue_status
=
:removed
@added_meeting
.
save
track_meeting_removed_event
issue
.
zoom_meetings
end
...
...
app/services/zoom_notes_service.rb
View file @
97330c56
# frozen_string_literal: true
class
ZoomNotesService
def
initialize
(
issue
,
project
,
current_user
,
old_
zoom_meeting
s
)
def
initialize
(
issue
,
project
,
current_user
,
old_
association
s
)
@issue
=
issue
@project
=
project
@current_user
=
current_user
@old_zoom_meetings
=
old_
zoom_meetings
@old_zoom_meetings
=
old_
associations
?
old_associations
.
fetch
(
:zoom_meetings
,
[])
:
[]
end
def
execute
...
...
@@ -21,9 +21,7 @@ class ZoomNotesService
private
def
zoom_link_added?
meetings
=
@issue
.
zoom_meetings
.
select
do
|
z
|
z
.
issue_status
==
ZoomMeeting
.
issue_statuses
[
:added
]
end
meetings
=
@issue
.
zoom_meetings
.
select
{
|
z
|
z
.
issue_status
==
"added"
}
!
meetings
.
empty?
end
...
...
spec/features/issues/user_creates_issue_spec.rb
View file @
97330c56
...
...
@@ -92,19 +92,6 @@ describe "User creates issue" do
.
and
have_content
(
label_titles
.
first
)
end
end
context
"with Zoom link"
do
it
"adds Zoom button"
do
issue_title
=
"Issue containing Zoom meeting link"
zoom_url
=
"https://gitlab.zoom.us/j/123456789"
fill_in
(
"Title"
,
with:
issue_title
)
fill_in
(
"Description"
,
with:
zoom_url
)
click_button
(
"Submit issue"
)
expect
(
page
).
to
have_link
(
'Join Zoom meeting'
,
href:
zoom_url
)
end
end
end
context
"when signed in as user with special characters in their name"
do
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
97330c56
...
...
@@ -29,6 +29,7 @@ issues:
-
prometheus_alerts
-
prometheus_alert_events
-
self_managed_prometheus_alert_events
-
zoom_meetings
events
:
-
author
-
project
...
...
spec/services/issues/update_service_spec.rb
View file @
97330c56
...
...
@@ -226,13 +226,9 @@ describe Issues::UpdateService, :mailer do
end
end
context
'blah'
do
before
do
let
(
:zoom_meeting
)
{
create
(
:zoom_meeting
,
issue:
issue
)
}
end
it
'creates zoom_link_added system note when a zoom link is added to the description'
do
update_issue
(
zoom_meetings:
[
zoom_meeting
])
context
'when zoom meetings is changed'
do
it
'creates zoom_link_added system note when a zoom link is added'
do
update_issue
(
zoom_meetings:
[
create
(
:zoom_meeting
,
issue:
issue
)])
note
=
find_note
(
'added a Zoom call'
)
expect
(
note
).
not_to
be_nil
...
...
spec/services/issues/zoom_link_service_spec.rb
View file @
97330c56
...
...
@@ -46,12 +46,6 @@ describe Issues::ZoomLinkService do
.
with
(
'IncidentManagement::ZoomIntegration'
,
'add_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
end
it
'tracks the add event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
.
with
(
'IncidentManagement::ZoomIntegration'
,
'add_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
end
end
shared_examples
'cannot add meeting'
do
...
...
@@ -119,6 +113,12 @@ describe Issues::ZoomLinkService do
expect
(
result
.
payload
[
:zoom_meetings
].
filter
{
|
z
|
z
.
issue_status
==
1
})
.
to
be_empty
end
it
'tracks the remove event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
.
with
(
'IncidentManagement::ZoomIntegration'
,
'remove_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
end
end
subject
(
:result
)
{
service
.
remove_link
}
...
...
@@ -128,12 +128,6 @@ describe Issues::ZoomLinkService do
context
'removes the link'
do
include_examples
'can remove meeting'
it
'tracks the remove event'
do
expect
(
Gitlab
::
Tracking
).
to
receive
(
:event
)
.
with
(
'IncidentManagement::ZoomIntegration'
,
'remove_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
end
end
context
'with insufficient permissions'
do
...
...
spec/services/zoom_notes_service_spec.rb
View file @
97330c56
...
...
@@ -7,12 +7,12 @@ describe ZoomNotesService do
let
(
:issue
)
{
OpenStruct
.
new
(
zoom_meetings:
zoom_meetings
)
}
let
(
:project
)
{
Object
.
new
}
let
(
:user
)
{
Object
.
new
}
let
(
:added_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:added
]
)
}
let
(
:removed_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:removed
]
)
}
let
(
:added_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
"added"
)
}
let
(
:removed_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
"removed"
)
}
let
(
:old_zoom_meetings
)
{
[]
}
let
(
:zoom_meetings
)
{
[]
}
subject
{
described_class
.
new
(
issue
,
project
,
user
,
old_zoom_meetings
)
}
subject
{
described_class
.
new
(
issue
,
project
,
user
,
zoom_meetings:
old_zoom_meetings
)
}
shared_examples
'no notifications'
do
it
"doesn't create notifications"
do
...
...
@@ -23,6 +23,44 @@ describe ZoomNotesService do
end
end
shared_examples
'added notification'
do
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_removed
)
subject
.
execute
end
end
shared_examples
'removed notification'
do
it
'creates a zoom_link_removed notification'
do
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_removed
)
subject
.
execute
end
end
context
'when zoom_meetings is not in old_associations'
do
subject
{
described_class
.
new
(
issue
,
project
,
user
,
{})
}
context
'when zoom_meetings is empty'
do
it_behaves_like
'no notifications'
end
context
'when zoom_meetings has "added" meeting'
do
let
(
:zoom_meetings
)
{
[
added_zoom_meeting
]
}
it_behaves_like
'added notification'
end
context
'when zoom_meetings has "removed" meeting'
do
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
]
}
it_behaves_like
'removed notification'
end
end
context
'when zoom_meetings == old_zoom_meetings'
do
context
'when both are empty'
do
it_behaves_like
'no notifications'
...
...
@@ -34,43 +72,34 @@ describe ZoomNotesService do
it_behaves_like
'no notifications'
end
end
context
'when both are added'
do
let
(
:old_zoom_meetings
)
{
[
added_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
old_zoom_meetings
}
it_behaves_like
'no notifications'
end
end
context
'when old_zoom_meetings is empty and zoom_meetings contains an
added
zoom_meeting'
do
context
'when old_zoom_meetings is empty and zoom_meetings contains an
"added"
zoom_meeting'
do
let
(
:old_zoom_meetings
)
{
[]
}
let
(
:zoom_meetings
)
{
[
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_removed
)
subject
.
execute
end
it_behaves_like
'added notification'
end
context
'when
the zoom link has been added
'
do
context
'when
a "added" meeting is added to a list of "removed" meetings
'
do
let
(
:old_zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
,
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_removed
)
subject
.
execute
end
it_behaves_like
'added notification'
end
context
'when
the zoom link has been removed from zoom_meetings
'
do
context
'when
zoom_meetings no longer has an "added" zoom meeting
'
do
let
(
:old_zoom_meetings
)
{
[
added_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
]
}
it
'creates a zoom_link_removed notification'
do
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_removed
)
subject
.
execute
end
it_behaves_like
'removed notification'
end
end
end
spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb
View file @
97330c56
...
...
@@ -2,38 +2,35 @@
shared_examples
'zoom quick actions'
do
let
(
:zoom_link
)
{
'https://zoom.us/j/123456789'
}
let
(
:existing_zoom_link
)
{
'https://zoom.us/j/123456780'
}
let
(
:invalid_zoom_link
)
{
'https://invalid-zoom'
}
before
do
issue
.
update!
(
description:
description
)
end
describe
'/zoom'
do
shared_examples
'skip silently'
do
it
'skip addition silently'
do
it
'skip
s
addition silently'
do
add_note
(
"/zoom
#{
zoom_link
}
"
)
wait_for_requests
expect
(
page
).
not_to
have_content
(
'Zoom meeting added'
)
expect
(
page
).
not_to
have_content
(
'Failed to add a Zoom meeting'
)
expect
(
issue
.
reload
.
description
).
to
eq
(
description
)
expect
(
issue
.
reload
.
zoom_meetings
[
0
].
url
).
not_to
eq
(
zoom_link
)
end
end
shared_examples
'success'
do
it
'adds a Zoom link'
do
add_note
(
"/zoom
#{
zoom_link
}
"
)
wait_for_requests
expect
(
page
).
to
have_content
(
'Zoom meeting added'
)
expect
(
issue
.
reload
.
description
).
to
end_with
(
zoom_link
)
expect
(
issue
.
reload
.
zoom_meetings
[
0
].
url
).
to
eq
(
zoom_link
)
end
end
context
'without issue description'
do
let
(
:description
)
{
nil
}
context
'without zoom_meetings'
do
include_examples
'success'
...
...
@@ -47,14 +44,18 @@ shared_examples 'zoom quick actions' do
end
end
context
'with Zoom link not at the end of the issue description'
do
let
(
:description
)
{
"A link
#{
zoom_link
}
not at the end"
}
context
'with "removed" zoom meeting'
do
before
do
create
(
:zoom_meeting
,
issue_status: :removed
,
url:
existing_zoom_link
,
issue:
issue
)
end
include_examples
'success'
end
context
'with Zoom link at end of the issue description'
do
let
(
:description
)
{
"Text
\n
#{
zoom_link
}
"
}
context
'with "added" zoom meeting'
do
before
do
create
(
:zoom_meeting
,
issue_status: :added
,
url:
existing_zoom_link
,
issue:
issue
)
end
include_examples
'skip silently'
end
...
...
@@ -62,19 +63,19 @@ shared_examples 'zoom quick actions' do
describe
'/remove_zoom'
do
shared_examples
'skip silently'
do
it
'skip removal silently'
do
it
'skip
s
removal silently'
do
add_note
(
'/remove_zoom'
)
wait_for_requests
expect
(
page
).
not_to
have_content
(
'Zoom meeting removed'
)
expect
(
page
).
not_to
have_content
(
'Failed to remove a Zoom meeting'
)
expect
(
issue
.
reload
.
description
).
to
eq
(
description
)
expect
(
issue
.
reload
.
zoom_meetings
.
filter
{
|
z
|
z
.
issue_status
==
ZoomMeeting
.
issue_statuses
[
:added
]
}).
to
be_empty
end
end
context
'with
Zoom link in the description
'
do
let
(
:description
)
{
"Text with
#{
zoom_link
}
\n\n\n
#{
zoom_link
}
"
}
context
'with
added zoom meeting
'
do
let
!
(
:added_zoom_meeting
)
{
create
(
:zoom_meeting
,
url:
zoom_link
,
issue:
issue
,
issue_status: :added
)
}
it
'removes last Zoom link'
do
add_note
(
'/remove_zoom'
)
...
...
@@ -82,14 +83,8 @@ shared_examples 'zoom quick actions' do
wait_for_requests
expect
(
page
).
to
have_content
(
'Zoom meeting removed'
)
expect
(
issue
.
reload
.
description
).
to
eq
(
"Text with
#{
zoom_link
}
"
)
expect
(
issue
.
reload
.
zoom_meetings
.
filter
{
|
z
|
z
.
issue_status
==
ZoomMeeting
.
issue_statuses
[
:added
]
}).
to
be_empty
end
end
context
'with a Zoom link not at the end of the description'
do
let
(
:description
)
{
"A link
#{
zoom_link
}
not at the end"
}
include_examples
'skip silently'
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