From b82772710237c33fc9dee197ecca9ec52bf445dc Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sun, 7 Apr 2024 08:12:38 -0700 Subject: [PATCH] Rename `AuthUser#neopass?` -> `AuthUser#uses_neopass?` This is more consistent with the `uses_omniauth?` we already have, and it also will help for the next change, where I want a `uses_password?` method (and using the name `password?` breaks some of Devise's validation code). --- app/models/auth_user.rb | 4 ++-- app/models/user.rb | 2 +- app/views/devise/registrations/edit.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/auth_user.rb b/app/models/auth_user.rb index a6d077e0..f8ff9a60 100644 --- a/app/models/auth_user.rb +++ b/app/models/auth_user.rb @@ -40,7 +40,7 @@ class AuthUser < AuthRecord super && !uses_omniauth? end - def neopass? + def uses_neopass? provider == "neopass" end @@ -50,7 +50,7 @@ class AuthUser < AuthRecord def disconnect_neopass # If there's no NeoPass, we're already done! - return true if !neopass? + return true if !uses_neopass? begin # Remove all of the NeoPass fields, and return whether we were diff --git a/app/models/user.rb b/app/models/user.rb index 058250d4..a7be88d9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,7 +4,7 @@ class User < ApplicationRecord PreviewTopContributorsCount = 3 belongs_to :auth_user, foreign_key: :remote_id, inverse_of: :user - delegate :neopass?, :disconnect_neopass, to: :auth_user + delegate :disconnect_neopass, to: :auth_user has_many :closet_hangers has_many :closet_lists diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 4c9ba44f..c990065a 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -52,7 +52,7 @@ <% end %> -<% if resource.neopass? %> +<% if resource.uses_neopass? %> <%= form_with url: user_neopass_connection_path(resource.user), method: :delete, class: "settings-form", data: { turbo_confirm: "Are you sure? Without a NeoPass, you'll need to use " +