Skip to content
Snippets Groups Projects

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Attaching the screenshot of how the issue looks within my gmail:

    duplicate_emails

  • Added 23 commits:

    • 75cd22bf...d73d2a5e - 22 commits from branch gitlab-org:master
    • d0576801 - Fixed duplicated issue note email notifications.
  • username-removed-24217 Title changed from Fixed duplicated issue note email notifications. to WIP: Fixed duplicated issue note email notifications.

    Title changed from Fixed duplicated issue note email notifications. to WIP: Fixed duplicated issue note email notifications.

  • spec/services/notification_service_spec.rb was changed in master creating 13 conflicts here.

    Will resolve these and remove "WIP:".

  • Added 228 commits:

    • d0576801...d2f9a901 - 227 commits from branch gitlab-org:master
    • f7bb5eb3 - Fixed duplicated issue note email notifications.
  • Added 3 commits:

    • f7bb5eb3...4294d2cd - 2 commits from branch gitlab-org:master
    • caa6851b - Fixed duplicated issue note email notifications.
  • username-removed-24217 Title changed from WIP: Fixed duplicated issue note email notifications. to Fixed duplicated issue note email notifications.

    Title changed from WIP: Fixed duplicated issue note email notifications. to Fixed duplicated issue note email notifications.

  • 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
  • Stan Hu mentioned in commit e2c57a41

    mentioned in commit e2c57a41

  • Stan Hu Status changed to merged

    Status changed to merged

  • Maintainer

    Thanks, @bak1an!

  • Patricio Cano mentioned in commit 3e977284

    mentioned in commit 3e977284

Please register or sign in to reply
Loading