Skip to content

Instantly share code, notes, and snippets.

@ashfurrow
Last active November 1, 2018 20:53
Show Gist options
  • Save ashfurrow/9f40f8cbc1e63df725ab5c1f92d2bb18 to your computer and use it in GitHub Desktop.
Save ashfurrow/9f40f8cbc1e63df725ab5c1f92d2bb18 to your computer and use it in GitHub Desktop.
# Sometimes a user will realize they've been accidentally tooting with the wrong privay setting in a specific browswer or app, and they meant their posts to be private. This script does that.
# Hey, uh, admins? Don't do this, unless you *really* trust the user. Changing status privacy after the fact can be abused. See: https://github.com/tootsuite/mastodon/issues/3933
# Open a rails console.
ids = %w( PASTE_IDS_LIST )
statuses = ids.map { |i| Status.find(i) }
statuses.reject { |s| s.uri.include? "USERNAME" } # Check that all the statuses belong to the user
statuses.first.uri # Open in an incognito browser
statuses.first.update_attributes!(visibility: :private) # Test one status change
# Refresh browser, verify this worked.
statuses.map { |s| s.update_attributes!(visibility: :private) }.uniq # Do them all.
ids.map { |i| Status.find(i) }.select { |s| s.visibility != "private" } # Verify this is empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment