diff --git a/app/models/journals_for_message_observer.rb b/app/models/journals_for_message_observer.rb index 3bca4779..f0dce08c 100644 --- a/app/models/journals_for_message_observer.rb +++ b/app/models/journals_for_message_observer.rb @@ -1,7 +1,7 @@ # Added by young class JournalsForMessageObserver < ActiveRecord::Observer - def after_create(journal_for_message) - Mailer.journals_for_message_add(User.current, journal_for_message).deliver + def after_create(journals_for_message) + Mailer.journals_for_message_add(User.current, journals_for_message).deliver end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ed942f0d..5f71ce45 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -29,12 +29,14 @@ class Mailer < ActionMailer::Base # Builds a Mail::Message object used to email recipients of the added journals for message. # - # def journals_for_message_add(user, journals_for_message) - # @user = User.current - # @url = url_for(:controller => 'users', :action => 'user_newfeedback') - # mail :to => user.mail, - # :subject => "hello" - # end + def journals_for_message_add(user, journals_for_message) + @user = User.current + @mail = journals_for_message.jour + @message = journals_for_message.notes + @url = url_for(:controller => 'users', :action => 'user_newfeedback', :id => @mail) + mail :to => @mail.mail, + :subject => "You have a new message" + end # Builds a Mail::Message object used to email recipients of the added issue. # diff --git a/app/views/mailer/journals_for_message_add.html.erb b/app/views/mailer/journals_for_message_add.html.erb new file mode 100644 index 00000000..cef20b5c --- /dev/null +++ b/app/views/mailer/journals_for_message_add.html.erb @@ -0,0 +1,3 @@ +

<%= link_to("hello", @url) %>

+<%=h @user %> +
<%= @message %>
diff --git a/app/views/mailer/journals_for_message_add.text.erb b/app/views/mailer/journals_for_message_add.text.erb new file mode 100644 index 00000000..0ac80dfe --- /dev/null +++ b/app/views/mailer/journals_for_message_add.text.erb @@ -0,0 +1,3 @@ +<%= link_to("hello", @url) %> +<%=h @user %> +<%= @message %> \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index e434bd2a..593eed64 100644 --- a/config/application.rb +++ b/config/application.rb @@ -23,7 +23,7 @@ module RedmineApp # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Activate observers that should always be running. - config.active_record.observers = :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer + config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer config.active_record.store_full_sti_class = true config.active_record.default_timezone = :local