Project

General

Profile

Actions

Defect #4513

closed

MessageObserver: wrong use of compact.uniq??

Added by Anh Kỳ Huỳnh almost 15 years ago. Updated almost 15 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2010-01-02
Due date:
% Done:

0%

Estimated time:
Resolution:
No feedback
Affected version:

Description

In the class MessageObserver, there is a line to compact the list of recipients

recipients = recipients.compact.uniq

The purpose of this line is to make recipients array contains each item once. But I found I still have duplicate items in message_posted (class Mailer). I don't know why so I have to change it:

    parsed = Array.new
    recipients = recipients.select do |m|
      next if parsed.include?(m.user.id)
      send_mail = check_if_user_want_to_receive_mail(m)
      parsed << m.user.id
      send_mail
    end.collect{|m| m.user.mail}

and then I don't have any duplicated items anymore in recipients. I amnot sure but I think this problem is due to Rails/Ruby.

Hope this helps.

My environment: (Redmine 0.8.5)

About your application's environment 

Ruby version              1.8.7 (i686-linux)
RubyGems version          1.3.5
Rails version             2.1.2
Active Record version     2.1.2
Action Pack version       2.1.2
Active Resource version   2.1.2
Action Mailer version     2.1.2
Active Support version    2.1.2
Edge Rails revision       unknown
Application root          /path/to/viettug.org
Environment               development
Database adapter          mysql
Database schema version   101

About your Redmine plugins
Redmine Vote plugin   0.0.2
Blog Plugin           1.1.0
Actions #1

Updated by Jean-Philippe Lang almost 15 years ago

Please provide a failing test. Also, this code calls an undefined #check_if_user_want_to_receive_mail.

Actions #2

Updated by g b almost 15 years ago

  • Status changed from New to Resolved
Actions #3

Updated by Jean-Philippe Lang almost 15 years ago

  • Status changed from Resolved to New
Actions #4

Updated by Jean-Philippe Lang almost 15 years ago

  • Status changed from New to Closed
  • Resolution set to No feedback
Actions

Also available in: Atom PDF