discourse/lib/tasks/user_actions.rake

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1001 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2013-02-05 14:16:51 -05:00
desc "rebuild the user_actions table"
2013-02-25 11:42:20 -05:00
task "user_actions:rebuild" => :environment do
2013-02-05 14:16:51 -05:00
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
2013-02-05 14:16:51 -05:00
end