Rework the email change flow to tie to memberships

This commit is contained in:
Stanko K.R.
2025-10-29 18:35:05 +01:00
parent 8e0efd2f38
commit 452c6a8373
22 changed files with 247 additions and 164 deletions
+1 -11
View File
@@ -1,5 +1,5 @@
class Identity < UntenantedRecord
include EmailAddressChangeable, Transferable
include Transferable
has_many :memberships, dependent: :destroy
has_many :magic_links, dependent: :destroy
@@ -14,16 +14,6 @@ class Identity < UntenantedRecord
end
end
def link_to(tenant, context: nil)
memberships.find_or_create_by!(tenant: tenant) do |membership|
membership.context = context
end
end
def unlink_from(tenant)
memberships.find_by(tenant: tenant)&.destroy
end
def staff?
email_address.ends_with?("@37signals.com") || email_address.ends_with?("@basecamp.com")
end