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).
This commit is contained in:
Emi Matchu 2024-04-07 08:12:38 -07:00
parent 89fc99c918
commit b827727102
3 changed files with 4 additions and 4 deletions

View file

@ -40,7 +40,7 @@ class AuthUser < AuthRecord
super && !uses_omniauth? super && !uses_omniauth?
end end
def neopass? def uses_neopass?
provider == "neopass" provider == "neopass"
end end
@ -50,7 +50,7 @@ class AuthUser < AuthRecord
def disconnect_neopass def disconnect_neopass
# If there's no NeoPass, we're already done! # If there's no NeoPass, we're already done!
return true if !neopass? return true if !uses_neopass?
begin begin
# Remove all of the NeoPass fields, and return whether we were # Remove all of the NeoPass fields, and return whether we were

View file

@ -4,7 +4,7 @@ class User < ApplicationRecord
PreviewTopContributorsCount = 3 PreviewTopContributorsCount = 3
belongs_to :auth_user, foreign_key: :remote_id, inverse_of: :user 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_hangers
has_many :closet_lists has_many :closet_lists

View file

@ -52,7 +52,7 @@
</div> </div>
<% end %> <% end %>
<% if resource.neopass? %> <% if resource.uses_neopass? %>
<%= form_with url: user_neopass_connection_path(resource.user), method: :delete, <%= form_with url: user_neopass_connection_path(resource.user), method: :delete,
class: "settings-form", data: { class: "settings-form", data: {
turbo_confirm: "Are you sure? Without a NeoPass, you'll need to use " + turbo_confirm: "Are you sure? Without a NeoPass, you'll need to use " +