修改bug《课程讨论区老师不能给帖子置顶》
Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
14ca7bcf9c
commit
fecf9513b9
|
@ -78,9 +78,13 @@ class Message < ActiveRecord::Base
|
||||||
|
|
||||||
|
|
||||||
safe_attributes 'subject', 'content'
|
safe_attributes 'subject', 'content'
|
||||||
safe_attributes 'locked', 'sticky', 'board_id',
|
safe_attributes 'board_id','locked', 'sticky',
|
||||||
:if => lambda {|message, user|
|
:if => lambda {|message, user|
|
||||||
|
if message.project
|
||||||
user.allowed_to?(:edit_messages, message.project)
|
user.allowed_to?(:edit_messages, message.project)
|
||||||
|
else
|
||||||
|
user.allowed_to?(:edit_messages, message.course)
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
def visible?(user=User.current)
|
def visible?(user=User.current)
|
||||||
|
@ -158,6 +162,7 @@ class Message < ActiveRecord::Base
|
||||||
#更新用户分数 -by zjc
|
#更新用户分数 -by zjc
|
||||||
def be_user_score
|
def be_user_score
|
||||||
#新建message且无parent的为发帖
|
#新建message且无parent的为发帖
|
||||||
|
|
||||||
if self.parent_id.nil? && !self.board.project.nil?
|
if self.parent_id.nil? && !self.board.project.nil?
|
||||||
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
|
UserScore.joint(:post_message, self.author,nil,self, { message_id: self.id })
|
||||||
update_memo_number(self.author,1)
|
update_memo_number(self.author,1)
|
||||||
|
|
Loading…
Reference in New Issue