Project

General

Profile

Patch #13413 » changeset_r71317ed3d9fa6bcdaf9eadcf9f18684a31a5f6ad.diff

Jan from Planio www.plan.io, 2013-03-09 18:13

View differences:

app/models/mailer.rb
359 359
    issues_by_assignee = scope.all(:include => [:status, :assigned_to, :project, :tracker]).group_by(&:assigned_to)
360 360
    issues_by_assignee.each do |assignee, issues|
361
      deliver_reminder(assignee, issues, days) if assignee.is_a?(User) && assignee.active?
361
      if assignee.is_a?(User) && assignee.active? && assignee.pref.reminder_days.present?
362
        pref_days = assignee.pref.reminder_days.to_i
363
        issues.reject!{|issue| issue.due_date.to_datetime > pref_days.days.from_now }
364
        deliver_reminder(assignee, issues, pref_days < days ? pref_days : days) if issues.any?
365
      end
362 366
    end
363 367
  end
app/models/user_preference.rb
59 59
  def default_assign_issues_to_me; self[:default_assign_issues_to_me] || '0'; end
60 60
  def default_assign_issues_to_me=(value); self[:default_assign_issues_to_me]=value; end
61

  
62
  def reminder_days; self[:reminder_days] || ''; end
63
  def reminder_days=(value); self[:reminder_days] = value.blank? ? '' : value.to_i; end
61 64
end
app/views/users/_preferences.html.erb
4 4
<p><%= pref_fields.select :comments_sorting, [[l(:label_chronological_order), 'asc'], [l(:label_reverse_chronological_order), 'desc']] %></p>
5 5
<p><%= pref_fields.check_box :warn_on_leaving_unsaved %></p>
6 6
<p><%= pref_fields.check_box :default_assign_issues_to_me %></p>
7
<p><%= pref_fields.text_field :reminder_days, :size => 6 %> <%= l(:label_before) %>
8
<em class="info"><%= l(:text_reminder_days) %></em></p>
7 9
<% end %>
config/locales/de.yml
626 626
  label_less_than_ago: vor weniger als
627 627
  label_more_than_ago: vor mehr als
628 628
  label_ago: vor
629
  label_before: Tage vorher
629 630
  label_contains: enthält
630 631
  label_not_contains: enthält nicht
631 632
  label_day_plural: Tage
......
961 962
  setting_gantt_items_limit: Maximale Anzahl von Tickets die im Gantt-Chart angezeigt werden.
962 963
  field_default_assign_issues_to_me: Tickets die ich anlege mir selbst zuweisen
963 964
  field_warn_on_leaving_unsaved: vor dem Verlassen einer Seite mit ungesichertem Text im Editor warnen
965
  field_reminder_days: E-Mail-Erinnerung für fällige Tickets
964 966
  text_warn_on_leaving_unsaved: Die aktuellen Änderungen gehen verloren, wenn Sie diese Seite verlassen.
967
  text_reminder_days: Feld leer lassen für keine Erinnerungen
965 968
  label_my_queries: Meine eigenen Abfragen
966 969
  text_journal_changed_no_detail: "%{label} aktualisiert"
967 970
  label_news_comment_added: Kommentar zu einem Blog-Artikel hinzugefügt
config/locales/en.yml
323 323
  field_visible: Visible
324 324
  field_default_assign_issues_to_me: Assign new issues to myself by default
325 325
  field_warn_on_leaving_unsaved: "Warn me when leaving a page with unsaved text"
326
  field_reminder_days: Due issue email reminders
326 327
  field_issues_visibility: Issues visibility
327 328
  field_is_private: Private
328 329
  field_commit_logs_encoding: Commit messages encoding
......
671 672
  label_less_than_ago: less than days ago
672 673
  label_more_than_ago: more than days ago
673 674
  label_ago: days ago
675
  label_before: days before
674 676
  label_contains: contains
675 677
  label_not_contains: doesn't contain
676 678
  label_day_plural: days
......
1020 1022
  text_issue_conflict_resolution_cancel: "Discard all my changes and redisplay %{link}"
1021 1023
  text_account_destroy_confirmation: "Are you sure you want to proceed?\nYour account will be permanently deleted, with no way to reactivate it."
1022 1024
  text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
1025
  text_reminder_days: Leave blank for no reminders
1023 1026
  default_role_manager: Manager
1024 1027
  default_role_developer: Developer
test/fixtures/user_preferences.yml
17 17
user_preferences_002:
18 18
  others: |
19 19
    ---
20
    :reminder_days: 42
20 21
    :my_page_layout:
21 22
      left:
22 23
      - latestnews
    (1-1/1)