Summary

Users want to be able to mark their profiles as “private”. This will prevent all users from viewing their profile except for the user who owns the profile as well as admin users.

GitHub Issue

Proposals

Visibility Persistence

Proposal 1: Add visibility enum field to Profile

def change
  add_column :profiles, :visibility, :integer, default: 0, null: false
end

# app/models/profile.rb
class Profile < ApplicationRecord
  enum {
    private: 0,
    public: 1
  }
end

Pros

  1. More flexible in the event that other states are needed in the future
  2. Not much more complicated to implement compared to the boolean flag

Cons

  1. How likely is it that we’d want to support more states? Maybe one future example could be something like agency_viewable (probably not a great name lol) where it’s viewable by all agency members/admins but still not publicly viewable.

Proposal 2: Add public boolean field to Profile

def change
  add_column :profiles, :public, :boolean, default: false, null: false
end

A profile is considered “private” if this boolean field is false and public if it’s true

Pros

  1. Super simple

Cons

  1. Restricted to just the two states.

Deployment