Rework the email change flow to tie to memberships
This commit is contained in:
+1
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user