mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 19:54:22 +08:00
b58867b6e9
Includes support for flags, reviewable users and queued posts, with REST API backwards compatibility. Co-Authored-By: romanrizzi <romanalejandro@gmail.com> Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
40 lines
970 B
Ruby
40 lines
970 B
Ruby
desc "rebuild the user_actions table"
|
|
task "user_actions:rebuild" => :environment do
|
|
MessageBus.off
|
|
UserAction.delete_all
|
|
PostAction.all.each do |i|
|
|
if i.deleted_at.nil?
|
|
UserActionManager.post_action_created(i)
|
|
else
|
|
UserActionManager.post_action_destroyed(i)
|
|
end
|
|
end
|
|
Topic.all.each { |i| UserActionManager.log_topic(i) }
|
|
Post.all.each do |i|
|
|
if i.deleted_at.nil?
|
|
UserActionManager.post_created(i)
|
|
else
|
|
UserActionManager.post_destroyed(i)
|
|
end
|
|
end
|
|
Notification.all.each do |notification|
|
|
|
|
if notification.post.deleted_at.nil?
|
|
UserActionManager.notification_created(
|
|
notification.post,
|
|
notification.user,
|
|
notification.notification_type,
|
|
notification.user
|
|
)
|
|
else
|
|
UserActionManager.notification_destroyed(
|
|
notification.post,
|
|
notification.user,
|
|
notification.notification_type,
|
|
notification.user
|
|
)
|
|
end
|
|
|
|
end
|
|
end
|