An error occurred while fetching the assigned milestone of the selected merge_request.
Fixed duplicated issue note email notifications.
Fixes #2560 (closed)
See issue for the details.
Without uniq
modified tests were failing with:
Failure/Error: notification.new_note(note)
(Notify (class)).note_issue_email(21, 1)
expected: 1 time with arguments: (21, 1)
received: 2 times with arguments: (21, 1)
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/extensions/action_mailer.rb:17:in `public_send'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/extensions/action_mailer.rb:17:in `perform'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/testing.rb:74:in `block in raw_push'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/testing.rb:69:in `each'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/testing.rb:69:in `raw_push'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/client.rb:68:in `push'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/worker.rb:85:in `client_push'
# /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/sidekiq-3.3.0/lib/sidekiq/extensions/generic_proxy.rb:19:in `method_missing'
# ./app/services/notification_service.rb:144:in `block in new_note'
# ./app/services/notification_service.rb:143:in `each'
# ./app/services/notification_service.rb:143:in `new_note'
# ./spec/services/notification_service_spec.rb:63:in `block (5 levels) in <top (required)>'
I have also added once
to all should_email
checks within notification_service_spec.rb
since it's probably the correct behavior to notify users only once on the same event. Nothing else failed out of the box but we can keep these assertions for future.
Merge request reports
Activity
Added 23 commits:
-
75cd22bf...d73d2a5e - 22 commits from branch
gitlab-org:master
- d0576801 - Fixed duplicated issue note email notifications.
-
75cd22bf...d73d2a5e - 22 commits from branch
Added 228 commits:
- d0576801...d2f9a901 - 227 commits from branch
gitlab-org:master
- f7bb5eb3 - Fixed duplicated issue note email notifications.
- d0576801...d2f9a901 - 227 commits from branch
Tests are green now.
After rebase updated tests were failing without
recipients = recipients.uniq
with:1) NotificationService Notes issue note new_note should be truthy Failure/Error: expect(sent_to_user?(user)).to be_truthy expected: truthy value got: false # ./spec/services/notification_service_spec.rb:402:in `should_email' # ./spec/services/notification_service_spec.rb:64:in `block (5 levels) in <top (required)>' # ./spec/services/notification_service_spec.rb:8:in `block (3 levels) in <top (required)>' # /home/bak1an/.rvm/gems/ruby-2.1.6@gitlab/gems/activejob-4.2.4/lib/active_job/test_helper.rb:198:in `perform_enqueued_jobs' # ./spec/services/notification_service_spec.rb:7:in `block (2 levels) in <top (required)>' 23/23 |==================================================================== 100 =====================================================================>| Time: 00:00:28 Finished in 28.02 seconds (files took 9.22 seconds to load) 23 examples, 1 failure
mentioned in commit e2c57a41
Thanks, @bak1an!
mentioned in commit 3e977284
Please register or sign in to reply