Skip to content
Snippets Groups Projects

Add notification to the former assignee upon unassignment

Adding new feature - Issue #3395 (closed). Upon unassignment of a user from issue add him to the recipients of the assignee changed notification email. Feedback is more than welcomed :)

This was implemented while being watched by @DouweM .

Fixes #3395 (closed)

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
362 362
363 363 def reassign_resource_email(target, project, current_user, method)
364 364 assignee_id_was = previous_record(target, "assignee_id")
365 recipients = build_recipients(target, project, current_user)
365 previous_assignee = User.find(assignee_id_was)
  • Douwe Maan
    Douwe Maan @DouweM started a thread on the diff
  • 377 378 end
    378 379 end
    379 380
    380 def build_recipients(target, project, current_user)
    381 def build_recipients(target, project, current_user, previous_records = nil )
    381 382 recipients = target.participants(current_user)
    383 recipients.concat(previous_records).compact.uniq if previous_records
  • Douwe Maan
    Douwe Maan @DouweM started a thread on the diff
  • 34 34 it { expect(@issue.labels.count).to eq(1) }
    35 35 it { expect(@issue.labels.first.title).to eq('Bug') }
    36 36
    37 it 'should send email to user2 about assign of new issue' do
    38 email = ActionMailer::Base.deliveries.last
    39 expect(email.to.first).to eq(user2.email)
    37 it 'should send email to user2 about assign of new issue and email to user about issue unassignment' do
    38 deliveries = ActionMailer::Base.deliveries
    39 email = deliveries.last
    40 recipients = deliveries.map(&:to).uniq.flatten
    41 expect(recipients.last(2)).to include(user.email,user2.email)
  • Douwe Maan mentioned in merge request !1818 (merged)

    mentioned in merge request !1818 (merged)

  • @adamliesko Thanks again for your work! I created !1818 (merged) based on this MR with a little bit of added refactoring.

  • Douwe Maan Status changed to closed

    Status changed to closed

  • Robert Speicher mentioned in commit b1abe90a

    mentioned in commit b1abe90a

  • Robert Speicher mentioned in commit c9f03247

    mentioned in commit c9f03247

  • Please register or sign in to reply
    Loading