2013-02-06 03:16:51 +08:00
|
|
|
desc "rebuild the user_actions table"
|
2013-02-26 00:42:20 +08:00
|
|
|
task "user_actions:rebuild" => :environment do
|
2013-02-06 03:16:51 +08:00
|
|
|
MessageBus.off
|
|
|
|
UserAction.delete_all
|
2017-07-28 09:20:09 +08:00
|
|
|
PostAction.all.each { |i| UserActionCreator.log_post_action(i) }
|
|
|
|
Topic.all.each { |i| UserActionCreator.log_topic(i) }
|
|
|
|
Post.all.each { |i| UserActionCreator.log_post(i) }
|
2016-12-22 12:03:40 +08:00
|
|
|
Notification.all.each do |notification|
|
|
|
|
UserActionCreator.log_notification(notification.post,
|
|
|
|
notification.user,
|
|
|
|
notification.notification_type,
|
|
|
|
notification.user)
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|