Skip to content

Commit

Permalink
The problem of reminder mail functionality when users are specified w…
Browse files Browse the repository at this point in the history
…as fixed. Mails are sent to the specified users only correctly now.
  • Loading branch information
preciousplum committed Jun 23, 2018
1 parent d9cc083 commit 003e4fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
name 'Expand Custom Users as Assignees plugin'
author 'preciousplum'
description 'Redmine plugin for adding assignee functionality includes default query and reminder to custom users'
version '0.0.2'
version '0.0.3'
url 'https://github.com/preciousplum/custom_users_as_assignees'
author_url 'https://github.com/preciousplum/'
end
7 changes: 4 additions & 3 deletions lib/custom_users_as_assignees/mailer_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def reminders_with_custom_users(options={})
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
" AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
)
scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
scope = scope.where(:project_id => project.id) if project
scope = scope.where(:fixed_version_id => target_version_id) if target_version_id.present?
scope = scope.where(:tracker_id => tracker.id) if tracker
Expand Down Expand Up @@ -61,8 +60,10 @@ def reminders_with_custom_users(options={})

issues_by_assignee.each do |assignee, issues|
if assignee.is_a?(User) && assignee.active? && issues.present?
visible_issues = issues.select {|i| i.visible?(assignee)}
reminder(assignee, visible_issues, days).deliver if visible_issues.present?
if user_ids.empty? || user_ids.include?(assignee.id.to_s)
visible_issues = issues.select {|i| i.visible?(assignee)}
reminder(assignee, visible_issues, days).deliver if visible_issues.present?
end
end
end
end
Expand Down

0 comments on commit 003e4fd

Please sign in to comment.