From c8399cdf584670918db6db93a3a0a353cfeae1e6 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 19 Aug 2015 17:49:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89forum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 3 ++- app/models/journals_for_message.rb | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f9ddc58f2..018cdf2e6 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -114,9 +114,10 @@ class UsersController < ApplicationController when nil @user_course_messages = @user.course_messages.reverse @user_forge_messages = @user.forge_messages.reverse - @user_forum_messages = @user.forum_messages.reverse + @user_memo_messages = @user.memo_messages.reverse @user_course_messages_count = @user_course_messages.count @user_forge_messages_count = @user_forum_messages.count + @user_memo_messages_count = @user_memo_messages.count when 'homework' @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") @user_course_messages_count = @user_course_messages.count diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index f1bdc7e7c..c9a511ccc 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -204,7 +204,7 @@ class JournalsForMessage < ActiveRecord::Base # 主留言 receivers = [] if self.reply_id == 0 - if self.author_id != self.jour_id # 过滤自己给自己的留言消息 + if self.user_id != self.jour_id # 过滤自己给自己的留言消息 receivers << self.jour end else # 回帖 @@ -218,8 +218,8 @@ class JournalsForMessage < ActiveRecord::Base end end if self.jour_type == 'Principal' - if self.user_id != self.jour.user_id - self.user_feedback_messages << UserFeedbackMessage.new(:user_id => self.jour.user_id, :memo_message_id => self.id, :memo_message_type => "Forum", :viewed => false) + if self.user_id != self.jour_id + self.user_feedback_messages << UserFeedbackMessage.new(:user_id => self.jour_id, :user_message_id => self.id, :user_message_type => "Forum", :viewed => false) end end end