User Profiles - When private profiles are disabled, all profiles should be public

What / Why

Related to Disable users from changing user profile to private (#421310)

We are currently implementing a new application setting that allows instance admins to disallow private profiles on their instance. However, there is currently nothing in place to remedy any existing private profiles when private profiles are disabled. We need to figure out an approach to not only disabling private profiles but enforcing all profiles are public

Screenshot

Screenshot of private profile on instance where private profiles are disabled

Proposal

I have a couple ideas of how we can address this

Option A: When setting is set to true, run migration to set all profiles to public (this could be very expensive on large instances)
Option B: Create a SSoT for public vs private profiles in backend that checks first if private profiles are allowed before checking a user's record
Option C: ???

Implementation Guide

TBD

Script to manually set all user profiles to public

Open the rails console by following this doc and run the following script:

update_time = Time.current
User.where(user_type: "human", private_profile: true).each_batch do |users|
  puts "Updating batch"
  users.update_all(private_profile: false, updated_at: update_time)
end
Edited by Abdul Wadood