mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 18:43:37 +08:00
FIX: invalidating inactive admin emails should mark them as not active
This commit is contained in:
parent
a1db15fead
commit
3b76f19668
|
@ -11,6 +11,7 @@ module Jobs
|
|||
.where('last_seen_at < ?', SiteSetting.invalidate_inactive_admin_email_after_days.days.ago)
|
||||
.each do |user|
|
||||
|
||||
user.deactivate
|
||||
user.email_tokens.update_all(confirmed: false, expired: true)
|
||||
|
||||
Discourse.authenticators.each do |authenticator|
|
||||
|
|
|
@ -11,7 +11,7 @@ describe Jobs::InvalidateInactiveAdmins do
|
|||
it "does nothing when all admins have been seen recently" do
|
||||
SiteSetting.invalidate_inactive_admin_email_after_days = 365
|
||||
subject
|
||||
expect(active_admin.active).to eq(true)
|
||||
expect(active_admin.reload.active).to eq(true)
|
||||
expect(active_admin.email_tokens.where(confirmed: true).exists?).to eq(true)
|
||||
end
|
||||
|
||||
|
@ -24,14 +24,14 @@ describe Jobs::InvalidateInactiveAdmins do
|
|||
SiteSetting.invalidate_inactive_admin_email_after_days = 365
|
||||
end
|
||||
|
||||
it 'marks email tokens as unconfirmed and keeps user as active' do
|
||||
it 'marks email tokens as unconfirmed' do
|
||||
subject
|
||||
expect(not_seen_admin.email_tokens.where(confirmed: true).exists?).to eq(false)
|
||||
expect(not_seen_admin.reload.email_tokens.where(confirmed: true).exists?).to eq(false)
|
||||
end
|
||||
|
||||
it 'keeps the user active' do
|
||||
it 'makes the user as not active' do
|
||||
subject
|
||||
expect(not_seen_admin.active).to eq(true)
|
||||
expect(not_seen_admin.reload.active).to eq(false)
|
||||
end
|
||||
|
||||
context 'with social logins' do
|
||||
|
@ -59,9 +59,9 @@ describe Jobs::InvalidateInactiveAdmins do
|
|||
|
||||
it 'does nothing' do
|
||||
subject
|
||||
expect(active_admin.active).to eq(true)
|
||||
expect(active_admin.reload.active).to eq(true)
|
||||
expect(active_admin.email_tokens.where(confirmed: true).exists?).to eq(true)
|
||||
expect(not_seen_admin.active).to eq(true)
|
||||
expect(not_seen_admin.reload.active).to eq(true)
|
||||
expect(not_seen_admin.email_tokens.where(confirmed: true).exists?).to eq(true)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user