Class: Update

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
CatarseAutoHtml
Defined in:
app/models/update.rb

Instance Method Summary collapse

Methods included from CatarseAutoHtml

catarse_auto_html_for

Instance Method Details

#email_comment_htmlObject



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/update.rb', line 24

def email_comment_html
  auto_html(comment) do
    html_escape map: {
      '&' => '&',
      '>' => '>',
      '<' => '&lt;',
      '"' => '"'
    }
    email_image width: 513
    redcloth target: :_blank
    link target: :_blank
  end
end

#notify_backersObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/models/update.rb', line 38

def notify_backers
  project.subscribed_users.each do |user|
    Rails.logger.info "[User #{user.id}] - Creating notification for #{user.name}"
    Notification.create_notification_once :updates, user,
      {update_id: self.id, user_id: user.id},
      update_number: self.project.updates.count,
      project_name: project.name,
      project_owner: project.user.display_name,
      project_owner_email: project.user.email,
      from: project.user.email,
      display_name: project.user.display_name,
      update_title: title,
      update: self,
      from: project.user.email,
      display_name: project.user.display_name,
      update_comment: email_comment_html
  end
end