diff options
author | Fire Demon <firedemon@creature.cafe> | 2020-07-21 14:52:34 -0500 |
---|---|---|
committer | Fire Demon <firedemon@creature.cafe> | 2020-08-30 05:44:01 -0500 |
commit | bbe174b422b3c72eda966fd6c31a6484fffdf753 (patch) | |
tree | e67ed6467e197099cb1f789b9d990c4a57773184 /db/migrate | |
parent | 750c48980b83689cdce849f058f661078c6dd228 (diff) |
[Privacy, Database] Limit visibility of replies to private posts
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20200721184347_limit_visibility_of_replies_to_private_statuses.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20200721184347_limit_visibility_of_replies_to_private_statuses.rb b/db/migrate/20200721184347_limit_visibility_of_replies_to_private_statuses.rb new file mode 100644 index 000000000..d22242bdd --- /dev/null +++ b/db/migrate/20200721184347_limit_visibility_of_replies_to_private_statuses.rb @@ -0,0 +1,13 @@ +class LimitVisibilityOfRepliesToPrivateStatuses < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def up + Status.includes(:thread).where.not(visibility: :direct).where(reply: true).where('statuses.in_reply_to_account_id != statuses.account_id').find_each do |status| + status.update!(visibility: status.thread.visibility) unless status.thread.nil? || %w(public unlisted).include?(status.thread.visibility) || ['direct', 'limited', status.thread.visibility].include?(status.visibility) + end + end + + def down + true + end +end |