Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

This commit is contained in:
ouyangxuhua 2015-08-20 10:39:41 +08:00
commit 27b42a5437
5 changed files with 27 additions and 2 deletions

View File

@ -147,7 +147,7 @@ class UsersController < ApplicationController
@user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Forum", @user).order("created_at desc")
@user_forge_messages_count = @user_forge_messages.count
when 'forum'
@user_memo_messages = Memo.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
@user_memo_messages = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
@user_memo_messages_count = @user_memo_messages.count
else
render_404

View File

@ -209,7 +209,8 @@ class JournalsForMessage < ActiveRecord::Base
end
else # 留言回复
# 添加留言回复人
if self.user_id != self.parent.user_id # 如果回帖人不是用户自己
# reply_to = User.find(self.reply_id)
if self.user_id != self.parent.user_id && self.user_id != self.reply_id # 如果回帖人不是用户自己
receivers << User.find(self.reply_id)
end
if self.user_id != self.parent.jour_id

View File

@ -0,0 +1,10 @@
class UserFeedbackMessage < ActiveRecord::Base
attr_accessible :journals_for_message_id, :journals_for_message_type, :user_id, :viewed
belongs_to :journals_for_message
belongs_to :user
validates :user_id,presence: true
validates :journals_for_message_id,presence: true
validates :journals_for_message_type, presence: true
end

View File

@ -0,0 +1,9 @@
FactoryGirl.define do
factory :user_feedback_message do
user_id 1
journals_for_message_id 1
journals_for_message_type "MyString"
viewed 1
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe UserFeedbackMessage, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end