[refs #54] Fix some bugs of issues and comments + add comment body to email

This commit is contained in:
konstantin.grabar 2011-12-31 14:51:47 +04:00
parent a44530980e
commit 16c9d0ec15
5 changed files with 8 additions and 8 deletions

View File

@ -16,7 +16,7 @@ class CommentsController < ApplicationController
@comment.user = current_user
if @comment.save
flash[:notice] = I18n.t("flash.comment.saved")
redirect_to :back
redirect_to [@commentable.project, @commentable]
else
flash[:error] = I18n.t("flash.comment.save_error")
render :action => 'new'

View File

@ -1,7 +1,7 @@
# coding: UTF-8
class UserMailer < ActionMailer::Base
default :from => APP_CONFIG['no-reply-email']
default :from => APP_CONFIG['do-not-reply-email']
def new_user_notification(user)
@user = user

View File

@ -9,11 +9,9 @@ class Comment < ActiveRecord::Base
protected
def deliver_new_comment_notification
recipients = self.commentable.project.relations.by_role('admin').where(:object_type => 'User').map { |rel| rel.read_attribute(:object_id) }
recipients = recipients | [self.commentable.user_id]
recipients = recipients | [self.commentable.project.owner_id] if self.commentable.project.owner_type == 'User'
recipients.each do |recipient_id|
recipient = User.find(recipient_id)
subscribes = self.commentable.subscribes
subscribes.each do |subscribe|
recipient = subscribe.user
UserMailer.delay.new_comment_notification(self, recipient)
end
end

View File

@ -52,5 +52,5 @@
%h2.title
= t("layout.comments.new_header")
.inner
= form_for :comment, :url => project_issue_comments_path(@project, @issue), :method => :post, :html => { :class => :form } do |f|
= form_for :comment, :url => project_issue_comments_path(@project, @issue.id), :method => :post, :html => { :class => :form } do |f|
= render :partial => "comments/form", :locals => {:f => f}

View File

@ -3,5 +3,7 @@
%p К задаче #{ link_to @comment.commentable.title, [@comment.commentable.project, @comment.commentable] } был добавлен новый комментарий.
%p "#{ @comment.body }"
%p== Команда поддержки «ROSA Build System»