Commit 1a619abf authored by allison.browne's avatar allison.browne

Address code review feedback

parent c86cbc5f
...@@ -14,7 +14,7 @@ class ZoomMeeting < ApplicationRecord ...@@ -14,7 +14,7 @@ class ZoomMeeting < ApplicationRecord
scope :added_to_issue, -> { where(issue_status: :added) } scope :added_to_issue, -> { where(issue_status: :added) }
scope :removed_from_issue, -> { where(issue_status: :removed) } scope :removed_from_issue, -> { where(issue_status: :removed) }
scope :canonical, -> (issue) { where(issue: issue)&.added_to_issue } scope :canonical, -> (issue) { where(issue: issue).added_to_issue }
def self.canonical_meeting(issue) def self.canonical_meeting(issue)
canonical(issue)&.first canonical(issue)&.first
......
...@@ -61,8 +61,7 @@ module Issues ...@@ -61,8 +61,7 @@ module Issues
end end
def remove_zoom_meeting def remove_zoom_meeting
@added_meeting.issue_status = :removed @added_meeting.update(issue_status: :removed)
@added_meeting.save
track_meeting_removed_event track_meeting_removed_event
issue.zoom_meetings issue.zoom_meetings
end end
......
...@@ -21,8 +21,7 @@ class ZoomNotesService ...@@ -21,8 +21,7 @@ class ZoomNotesService
private private
def zoom_link_added? def zoom_link_added?
meetings = @issue.zoom_meetings.select { |z| z.issue_status == "added" } @issue.zoom_meetings.any? { |z| z.issue_status == "added" }
!meetings.empty?
end end
def zoom_link_added_notification def zoom_link_added_notification
......
...@@ -187,7 +187,6 @@ describe Issues::UpdateService, :mailer do ...@@ -187,7 +187,6 @@ describe Issues::UpdateService, :mailer do
it 'creates system note about issue reassign' do it 'creates system note about issue reassign' do
note = find_note('assigned to') note = find_note('assigned to')
expect(note).not_to be_nil
expect(note.note).to include "assigned to #{user2.to_reference}" expect(note.note).to include "assigned to #{user2.to_reference}"
end end
...@@ -202,14 +201,12 @@ describe Issues::UpdateService, :mailer do ...@@ -202,14 +201,12 @@ describe Issues::UpdateService, :mailer do
it 'creates system note about title change' do it 'creates system note about title change' do
note = find_note('changed title') note = find_note('changed title')
expect(note).not_to be_nil
expect(note.note).to eq 'changed title from **{-Old-} title** to **{+New+} title**' expect(note.note).to eq 'changed title from **{-Old-} title** to **{+New+} title**'
end end
it 'creates system note about discussion lock' do it 'creates system note about discussion lock' do
note = find_note('locked this issue') note = find_note('locked this issue')
expect(note).not_to be_nil
expect(note.note).to eq 'locked this issue' expect(note.note).to eq 'locked this issue'
end end
end end
...@@ -221,7 +218,6 @@ describe Issues::UpdateService, :mailer do ...@@ -221,7 +218,6 @@ describe Issues::UpdateService, :mailer do
note = find_note('changed the description') note = find_note('changed the description')
expect(note).not_to be_nil
expect(note.note).to eq('changed the description') expect(note.note).to eq('changed the description')
end end
end end
...@@ -231,7 +227,6 @@ describe Issues::UpdateService, :mailer do ...@@ -231,7 +227,6 @@ describe Issues::UpdateService, :mailer do
update_issue(zoom_meetings: [create(:zoom_meeting, issue: issue)]) update_issue(zoom_meetings: [create(:zoom_meeting, issue: issue)])
note = find_note('added a Zoom call') note = find_note('added a Zoom call')
expect(note).not_to be_nil
expect(note.note).to eq('added a Zoom call to this issue') expect(note.note).to eq('added a Zoom call to this issue')
end end
end end
...@@ -253,7 +248,6 @@ describe Issues::UpdateService, :mailer do ...@@ -253,7 +248,6 @@ describe Issues::UpdateService, :mailer do
note = find_note('made the issue confidential') note = find_note('made the issue confidential')
expect(note).not_to be_nil
expect(note.note).to eq 'made the issue confidential' expect(note.note).to eq 'made the issue confidential'
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment