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
...
@@ -62,8 +62,7 @@ module Issues
notification_service
.
async
.
new_mentions_in_issue
(
issue
,
added_mentions
,
current_user
)
notification_service
.
async
.
new_mentions_in_issue
(
issue
,
added_mentions
,
current_user
)
end
end
old_zoom_meetings
=
old_associations
.
fetch
(
:zoom_meetings
,
[])
ZoomNotesService
.
new
(
issue
,
project
,
current_user
,
old_associations
).
execute
ZoomNotesService
.
new
(
issue
,
project
,
current_user
,
old_zoom_meetings
).
execute
end
end
def
handle_task_changes
(
issuable
)
def
handle_task_changes
(
issuable
)
...
...
app/services/issues/zoom_link_service.rb
View file @
97330c56
...
@@ -60,12 +60,14 @@ module Issues
...
@@ -60,12 +60,14 @@ module Issues
issue_status: :added
,
issue_status: :added
,
url:
link
url:
link
)
)
track_meeting_added_event
issue
.
zoom_meetings
issue
.
zoom_meetings
end
end
def
remove_zoom_meeting
def
remove_zoom_meeting
@added_meeting
.
issue_status
=
:removed
@added_meeting
.
issue_status
=
:removed
@added_meeting
.
save
@added_meeting
.
save
track_meeting_removed_event
issue
.
zoom_meetings
issue
.
zoom_meetings
end
end
...
...
app/services/zoom_notes_service.rb
View file @
97330c56
# frozen_string_literal: true
# frozen_string_literal: true
class
ZoomNotesService
class
ZoomNotesService
def
initialize
(
issue
,
project
,
current_user
,
old_
zoom_meeting
s
)
def
initialize
(
issue
,
project
,
current_user
,
old_
association
s
)
@issue
=
issue
@issue
=
issue
@project
=
project
@project
=
project
@current_user
=
current_user
@current_user
=
current_user
@old_zoom_meetings
=
old_
zoom_meetings
@old_zoom_meetings
=
old_
associations
?
old_associations
.
fetch
(
:zoom_meetings
,
[])
:
[]
end
end
def
execute
def
execute
...
@@ -21,9 +21,7 @@ class ZoomNotesService
...
@@ -21,9 +21,7 @@ class ZoomNotesService
private
private
def
zoom_link_added?
def
zoom_link_added?
meetings
=
@issue
.
zoom_meetings
.
select
do
|
z
|
meetings
=
@issue
.
zoom_meetings
.
select
{
|
z
|
z
.
issue_status
==
"added"
}
z
.
issue_status
==
ZoomMeeting
.
issue_statuses
[
:added
]
end
!
meetings
.
empty?
!
meetings
.
empty?
end
end
...
...
spec/features/issues/user_creates_issue_spec.rb
View file @
97330c56
...
@@ -92,19 +92,6 @@ describe "User creates issue" do
...
@@ -92,19 +92,6 @@ describe "User creates issue" do
.
and
have_content
(
label_titles
.
first
)
.
and
have_content
(
label_titles
.
first
)
end
end
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
end
context
"when signed in as user with special characters in their name"
do
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:
...
@@ -29,6 +29,7 @@ issues:
-
prometheus_alerts
-
prometheus_alerts
-
prometheus_alert_events
-
prometheus_alert_events
-
self_managed_prometheus_alert_events
-
self_managed_prometheus_alert_events
-
zoom_meetings
events
:
events
:
-
author
-
author
-
project
-
project
...
...
spec/services/issues/update_service_spec.rb
View file @
97330c56
...
@@ -226,13 +226,9 @@ describe Issues::UpdateService, :mailer do
...
@@ -226,13 +226,9 @@ describe Issues::UpdateService, :mailer do
end
end
end
end
context
'blah'
do
context
'when zoom meetings is changed'
do
before
do
it
'creates zoom_link_added system note when a zoom link is added'
do
let
(
:zoom_meeting
)
{
create
(
:zoom_meeting
,
issue:
issue
)
}
update_issue
(
zoom_meetings:
[
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
])
note
=
find_note
(
'added a Zoom call'
)
note
=
find_note
(
'added a Zoom call'
)
expect
(
note
).
not_to
be_nil
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
...
@@ -46,12 +46,6 @@ describe Issues::ZoomLinkService do
.
with
(
'IncidentManagement::ZoomIntegration'
,
'add_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
.
with
(
'IncidentManagement::ZoomIntegration'
,
'add_zoom_meeting'
,
label:
'Issue ID'
,
value:
issue
.
id
)
result
result
end
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
end
shared_examples
'cannot add meeting'
do
shared_examples
'cannot add meeting'
do
...
@@ -119,6 +113,12 @@ describe Issues::ZoomLinkService do
...
@@ -119,6 +113,12 @@ describe Issues::ZoomLinkService do
expect
(
result
.
payload
[
:zoom_meetings
].
filter
{
|
z
|
z
.
issue_status
==
1
})
expect
(
result
.
payload
[
:zoom_meetings
].
filter
{
|
z
|
z
.
issue_status
==
1
})
.
to
be_empty
.
to
be_empty
end
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
end
subject
(
:result
)
{
service
.
remove_link
}
subject
(
:result
)
{
service
.
remove_link
}
...
@@ -128,12 +128,6 @@ describe Issues::ZoomLinkService do
...
@@ -128,12 +128,6 @@ describe Issues::ZoomLinkService do
context
'removes the link'
do
context
'removes the link'
do
include_examples
'can remove meeting'
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
end
context
'with insufficient permissions'
do
context
'with insufficient permissions'
do
...
...
spec/services/zoom_notes_service_spec.rb
View file @
97330c56
...
@@ -7,12 +7,12 @@ describe ZoomNotesService do
...
@@ -7,12 +7,12 @@ describe ZoomNotesService do
let
(
:issue
)
{
OpenStruct
.
new
(
zoom_meetings:
zoom_meetings
)
}
let
(
:issue
)
{
OpenStruct
.
new
(
zoom_meetings:
zoom_meetings
)
}
let
(
:project
)
{
Object
.
new
}
let
(
:project
)
{
Object
.
new
}
let
(
:user
)
{
Object
.
new
}
let
(
:user
)
{
Object
.
new
}
let
(
:added_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:added
]
)
}
let
(
:added_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
"added"
)
}
let
(
:removed_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
ZoomMeeting
.
issue_statuses
[
:removed
]
)
}
let
(
:removed_zoom_meeting
)
{
OpenStruct
.
new
(
issue_status:
"removed"
)
}
let
(
:old_zoom_meetings
)
{
[]
}
let
(
:old_zoom_meetings
)
{
[]
}
let
(
: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
shared_examples
'no notifications'
do
it
"doesn't create notifications"
do
it
"doesn't create notifications"
do
...
@@ -23,6 +23,44 @@ describe ZoomNotesService do
...
@@ -23,6 +23,44 @@ describe ZoomNotesService do
end
end
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 zoom_meetings == old_zoom_meetings'
do
context
'when both are empty'
do
context
'when both are empty'
do
it_behaves_like
'no notifications'
it_behaves_like
'no notifications'
...
@@ -34,43 +72,34 @@ describe ZoomNotesService do
...
@@ -34,43 +72,34 @@ describe ZoomNotesService do
it_behaves_like
'no notifications'
it_behaves_like
'no notifications'
end
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
(
:old_zoom_meetings
)
{
[]
}
let
(
:zoom_meetings
)
{
[
added_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
it_behaves_like
'added notification'
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_removed
)
subject
.
execute
end
end
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
(
:old_zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
,
added_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
,
added_zoom_meeting
]
}
it
'creates a zoom_link_added notification'
do
it_behaves_like
'added notification'
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_removed
)
subject
.
execute
end
end
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
(
:old_zoom_meetings
)
{
[
added_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
]
}
let
(
:zoom_meetings
)
{
[
removed_zoom_meeting
]
}
it
'creates a zoom_link_removed notification'
do
it_behaves_like
'removed notification'
expect
(
SystemNoteService
).
not_to
receive
(
:zoom_link_added
).
with
(
issue
,
project
,
user
)
expect
(
SystemNoteService
).
to
receive
(
:zoom_link_removed
)
subject
.
execute
end
end
end
end
end
end
end
spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb
View file @
97330c56
...
@@ -2,38 +2,35 @@
...
@@ -2,38 +2,35 @@
shared_examples
'zoom quick actions'
do
shared_examples
'zoom quick actions'
do
let
(
:zoom_link
)
{
'https://zoom.us/j/123456789'
}
let
(
:zoom_link
)
{
'https://zoom.us/j/123456789'
}
let
(
:existing_zoom_link
)
{
'https://zoom.us/j/123456780'
}
let
(
:invalid_zoom_link
)
{
'https://invalid-zoom'
}
let
(
:invalid_zoom_link
)
{
'https://invalid-zoom'
}
before
do
issue
.
update!
(
description:
description
)
end
describe
'/zoom'
do
describe
'/zoom'
do
shared_examples
'skip silently'
do
shared_examples
'skip silently'
do
it
'skip addition silently'
do
it
'skip
s
addition silently'
do
add_note
(
"/zoom
#{
zoom_link
}
"
)
add_note
(
"/zoom
#{
zoom_link
}
"
)
wait_for_requests
wait_for_requests
expect
(
page
).
not_to
have_content
(
'Zoom meeting added'
)
expect
(
page
).
not_to
have_content
(
'Zoom meeting added'
)
expect
(
page
).
not_to
have_content
(
'Failed to add a Zoom meeting'
)
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
end
end
shared_examples
'success'
do
shared_examples
'success'
do
it
'adds a Zoom link'
do
it
'adds a Zoom link'
do
add_note
(
"/zoom
#{
zoom_link
}
"
)
add_note
(
"/zoom
#{
zoom_link
}
"
)
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_content
(
'Zoom meeting added'
)
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
end
end
context
'without issue description'
do
context
'without zoom_meetings'
do
let
(
:description
)
{
nil
}
include_examples
'success'
include_examples
'success'
...
@@ -47,14 +44,18 @@ shared_examples 'zoom quick actions' do
...
@@ -47,14 +44,18 @@ shared_examples 'zoom quick actions' do
end
end
end
end
context
'with Zoom link not at the end of the issue description'
do
context
'with "removed" zoom meeting'
do
let
(
:description
)
{
"A link
#{
zoom_link
}
not at the end"
}
before
do
create
(
:zoom_meeting
,
issue_status: :removed
,
url:
existing_zoom_link
,
issue:
issue
)
end
include_examples
'success'
include_examples
'success'
end
end
context
'with Zoom link at end of the issue description'
do
context
'with "added" zoom meeting'
do
let
(
:description
)
{
"Text
\n
#{
zoom_link
}
"
}
before
do
create
(
:zoom_meeting
,
issue_status: :added
,
url:
existing_zoom_link
,
issue:
issue
)
end
include_examples
'skip silently'
include_examples
'skip silently'
end
end
...
@@ -62,19 +63,19 @@ shared_examples 'zoom quick actions' do
...
@@ -62,19 +63,19 @@ shared_examples 'zoom quick actions' do
describe
'/remove_zoom'
do
describe
'/remove_zoom'
do
shared_examples
'skip silently'
do
shared_examples
'skip silently'
do
it
'skip removal silently'
do
it
'skip
s
removal silently'
do
add_note
(
'/remove_zoom'
)
add_note
(
'/remove_zoom'
)
wait_for_requests
wait_for_requests
expect
(
page
).
not_to
have_content
(
'Zoom meeting removed'
)
expect
(
page
).
not_to
have_content
(
'Zoom meeting removed'
)
expect
(
page
).
not_to
have_content
(
'Failed to remove a Zoom meeting'
)
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
end
end
context
'with
Zoom link in the description
'
do
context
'with
added zoom meeting
'
do
let
(
:description
)
{
"Text with
#{
zoom_link
}
\n\n\n
#{
zoom_link
}
"
}
let
!
(
:added_zoom_meeting
)
{
create
(
:zoom_meeting
,
url:
zoom_link
,
issue:
issue
,
issue_status: :added
)
}
it
'removes last Zoom link'
do
it
'removes last Zoom link'
do
add_note
(
'/remove_zoom'
)
add_note
(
'/remove_zoom'
)
...
@@ -82,14 +83,8 @@ shared_examples 'zoom quick actions' do
...
@@ -82,14 +83,8 @@ shared_examples 'zoom quick actions' do
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_content
(
'Zoom meeting removed'
)
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
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
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