--- mail_handler.rb.orig 2013-07-20 20:20:29.405022732 +0200 +++ mail_handler.rb 2013-07-21 08:58:21.471607222 +0200 @@ -126,6 +126,7 @@ MESSAGE_ID_RE = %r{^ user, :board => board) + message.subject = subject + message.content = cleaned_up_text_body + add_watchers(message) + message.save! + add_attachments(message) + + logger.info "MailHandler: message #{message.id} - \"#{message.subject}\" created by #{user}" if logger && logger.info + message + end + # Adds a note to an existing issue def receive_issue_reply(issue_id, from_journal=nil) issue = Issue.find_by_id(issue_id) @@ -266,7 +291,8 @@ # Adds To and Cc as watchers of the given object if the sender has the # appropriate permission def add_watchers(obj) - if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project) + if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project) \ + || obj.is_a?(Message) addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase} unless addresses.empty? watchers = User.active.where('LOWER(mail) IN (?)', addresses).all