Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete orphaned authors #708

Closed
1 task done
jonkerz opened this issue Jun 7, 2019 · 1 comment
Closed
1 task done

Delete orphaned authors #708

jonkerz opened this issue Jun 7, 2019 · 1 comment
Labels
Milestone

Comments

@jonkerz
Copy link
Member

jonkerz commented Jun 7, 2019

  • Run script
# For PaperTrail
antcat_bot = User.find 62
PaperTrail.whodunnit = antcat_bot.id

# For the activity feed
User.current = antcat_bot

Author.distinct.left_outer_joins(:references).where('references.id IS NULL').each do |author|
  next if author.references.exists?
  author.create_activity :destroy, edit_summary: "Delete orphaned author #{author.first_author_name_name}"
  author.destroy!
end

jonkerz = User.find 60
Activity.execute_script_activity jonkerz, "Delete orphaned authors, see %github708"
@jonkerz jonkerz added the script label Jun 7, 2019
@jonkerz
Copy link
Member Author

jonkerz commented Jun 7, 2019

@jonkerz jonkerz closed this as completed Jun 7, 2019
@jonkerz jonkerz added this to the 3.0.35 milestone Jun 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant