Project

General

Profile

Feature #26791 » 0002-Cleanup-Remove-Issue-each_notification-and-Journal-e.patch

Holger Just, 2017-08-30 12:46

View differences:

app/models/issue.rb
1042 1042
    notified_users.collect(&:mail)
1043 1043
  end
1044 1044

  
1045
  def each_notification(users, &block)
1046
    if users.any?
1047
      if custom_field_values.detect {|value| !value.custom_field.visible?}
1048
        users_by_custom_field_visibility = users.group_by do |user|
1049
          visible_custom_field_values(user).map(&:custom_field_id).sort
1050
        end
1051
        users_by_custom_field_visibility.values.each do |users|
1052
          yield(users)
1053
        end
1054
      else
1055
        yield(users)
1056
      end
1057
    end
1058
  end
1059

  
1060 1045
  def notify?
1061 1046
    @notify != false
1062 1047
  end
app/models/journal.rb
94 94
    end
95 95
  end
96 96

  
97
  def each_notification(users, &block)
98
    if users.any?
99
      users_by_details_visibility = users.group_by do |user|
100
        visible_details(user)
101
      end
102
      users_by_details_visibility.each do |visible_details, users|
103
        if notes? || visible_details.any?
104
          yield(users)
105
        end
106
      end
107
    end
108
  end
109

  
110 97
  # Returns the JournalDetail for the given attribute, or nil if the attribute
111 98
  # was not updated
112 99
  def detail_for_attribute(attribute)
(1-1/4)