1、讨论区新建帖子时增加权限判断

2、删除历史的匿名用户发布帖子的数据
guange_homework
sw 10 years ago
parent 62c657a827
commit 88397d58d0

@ -89,6 +89,7 @@ class MessagesController < ApplicationController
# Create a new topic
def new
if User.current.logged?
@message = Message.new
@message.author = User.current
@message.board = @board
@ -101,28 +102,6 @@ class MessagesController < ApplicationController
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end
# # 与我相关动态的记录add start
# if(@board && @board.course) #项目的先不管
# teachers = searchTeacherAndAssistant(@board.course)
# for teacher in teachers
# if(teacher.user_id != User.current.id)
# notify = ActivityNotify.new()
# if(@board.course)
# notify.activity_container_id = @board.course_id
# notify.activity_container_type = 'Course'
# else
# notify.activity_container_id = @board.project_id
# notify.activity_container_type = 'Project'
# end
# notify.activity_id = @message.id
# notify.activity_type = 'Message'
# notify.notify_to = teacher.user_id
# notify.is_read = 0
# notify.save()
# end
# end
# end
# 与我相关动态的记录add end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
@ -156,6 +135,9 @@ class MessagesController < ApplicationController
}
end
end
else
redirect_to signin_path
end
end
# Reply to a topic

@ -1,10 +1,11 @@
class DeleteAnonymousFeedback < ActiveRecord::Migration
def up
jour_count = JournalsForMessage.all.count / 30 + 2
puts jour_count
transaction do
for i in 1 ... jour_count do i
JournalsForMessage.page(i).per(30).each do |jour|
jour.destroy if jour.user_id == 2
jour.destroy if jour.user_id.to_s == "2"
end
end
end

@ -0,0 +1,15 @@
class DeleteAnonymousMessage < ActiveRecord::Migration
def up
message_count = Message.all.count / 30 + 2
transaction do
for i in 1 ... message_count do i
Message.page(i).per(30).each do |message|
message.destroy if jour.author_id.to_s == "2"
end
end
end
end
def down
end
end
Loading…
Cancel
Save