mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-25 11:42:43 +00:00
Extract User::Confirmation concern (#35582)
This commit is contained in:
parent
15b72591d4
commit
6dc55a2f4e
4 changed files with 138 additions and 97 deletions
22
app/models/concerns/user/confirmation.rb
Normal file
22
app/models/concerns/user/confirmation.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module User::Confirmation
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :confirmed, -> { where.not(confirmed_at: nil) }
|
||||
scope :unconfirmed, -> { where(confirmed_at: nil) }
|
||||
|
||||
def confirm
|
||||
wrap_email_confirmation { super }
|
||||
end
|
||||
end
|
||||
|
||||
def confirmed?
|
||||
confirmed_at.present?
|
||||
end
|
||||
|
||||
def unconfirmed?
|
||||
!confirmed?
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue