diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 44f0d15f4..921d7d12b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -473,7 +473,6 @@ class IssuesController < ApplicationController def reply @issue = Issue.find(params[:id]) @jour = Journal.find(params[:journal_id]) - @tempContent = "
#{ll(Setting.default_language, :text_user_wrote, @jour.user.realname.blank? ? @jour.user.login: @jour.user.realname)}".html_safe respond_to do |format| format.js end @@ -482,17 +481,17 @@ class IssuesController < ApplicationController #给issue添加journ。回复内容包含 对某个被回复的journ的内容 def add_reply if User.current.logged? - jour = Journal.new - jour.user_id = User.current.id - jour.notes = params[:quote]+params[:notes] + jour = Journal.find(params[:journal_id]) @issue = Issue.find params[:id] - jour.journalized = @issue - jour.save - update_user_activity(@issue.class,@issue.id) - update_forge_activity(@issue.class,@issue.id) + new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id) + @user_activity_id = params[:user_activity_id] + if new_jour.save + update_user_activity(@issue.class,@issue.id) + update_forge_activity(@issue.class,@issue.id) - respond_to do |format| - format.js + respond_to do |format| + format.js + end end end end @@ -501,7 +500,8 @@ class IssuesController < ApplicationController def delete_journal @issue = Issue.find(params[:id]) Journal.destroy(params[:journal_id]) - respond_to do |format| + @user_activity_id = params[:user_activity_id] + respond_to do |format| format.js end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6b9e8f4c9..2d16f1a2b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -98,6 +98,8 @@ class UsersController < ApplicationController @comment = OrgDocumentComment.find params[:comment].to_i when 'Comment' @comment = Comment.find params[:comment].to_i + when 'Journal' + @comment = Journal.find params[:comment].to_i end end @@ -142,6 +144,11 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'News' + when 'Issue' + @reply = Journal.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @type = 'Issue' end respond_to do |format| format.js @@ -3329,6 +3336,8 @@ class UsersController < ApplicationController when 'Issue' obj = Issue.where('id = ?', params[:id].to_i).first @journals = obj.journals.reorder("created_on desc") + @type = 'Issue' + @user_activity_id = params[:div_id].to_i if params[:div_id] when 'BlogComment' obj = BlogComment.where('id = ?', params[:id].to_i).first @user_activity_id = params[:div_id].to_i if params[:div_id] diff --git a/app/models/journal.rb b/app/models/journal.rb index 0f88fcb7f..d2cc9e539 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -37,6 +37,7 @@ class Journal < ActiveRecord::Base has_many :at_messages, as: :at_message, dependent: :destroy acts_as_attachable attr_accessor :indice + acts_as_tree :counter_cache => :comments_count, :order => "#{Journal.table_name}.created_on ASC" acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" }, :description =>:notes, diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb index bde98d456..f5c7c9094 100644 --- a/app/views/blog_comments/show.html.erb +++ b/app/views/blog_comments/show.html.erb @@ -135,13 +135,8 @@ <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
#{@jour.notes.html_safe}
<%= string %>
<% end %> <% end %> -<%= reply.notes.html_safe %>
+<%= comment.notes.html_safe %>