mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-28 20:55:37 +01:00
This commit is contained in:
parent
eda2bdfc7a
commit
89f89d738f
4 changed files with 3 additions and 4 deletions
|
@ -128,7 +128,7 @@ module Admin
|
|||
def unblock_email
|
||||
authorize @account, :unblock_email?
|
||||
|
||||
CanonicalEmailBlock.matching_account(@account).delete_all
|
||||
CanonicalEmailBlock.where(reference_account: @account).delete_all
|
||||
|
||||
log_action :unblock_email, @account
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ class CanonicalEmailBlock < ApplicationRecord
|
|||
validates :canonical_email_hash, presence: true, uniqueness: true
|
||||
|
||||
scope :matching_email, ->(email) { where(canonical_email_hash: email_to_canonical_email_hash(email)) }
|
||||
scope :matching_account, ->(account) { matching_email(account&.user_email).or(where(reference_account: account)) }
|
||||
|
||||
def to_log_human_identifier
|
||||
canonical_email_hash
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
= render 'admin/accounts/counters', account: @account
|
||||
|
||||
- if @account.local? && @account.user.nil?
|
||||
= link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.matching_account(@account).exists?
|
||||
= link_to t('admin.accounts.unblock_email'), unblock_email_admin_account_path(@account.id), method: :post, class: 'button' if can?(:unblock_email, @account) && CanonicalEmailBlock.exists?(reference_account_id: @account.id)
|
||||
- else
|
||||
.table-wrapper
|
||||
%table.table.inline-table
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
Fabricator(:canonical_email_block) do
|
||||
email { |attrs| attrs[:reference_account] ? attrs[:reference_account].user_email : sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
||||
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
||||
reference_account { Fabricate.build(:account) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue