mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: update timestamp when resending invite
This commit is contained in:
parent
5a57278a8e
commit
8fb41bf5fb
@ -116,6 +116,8 @@ class Invite < ActiveRecord::Base
|
|||||||
invite = nil
|
invite = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
invite.update_columns(created_at: Time.zone.now, updated_at: Time.zone.now) if invite
|
||||||
|
|
||||||
if !invite
|
if !invite
|
||||||
create_args = { invited_by: invited_by, email: lower_email }
|
create_args = { invited_by: invited_by, email: lower_email }
|
||||||
create_args[:moderator] = true if opts[:moderator]
|
create_args[:moderator] = true if opts[:moderator]
|
||||||
|
@ -102,8 +102,15 @@ describe Invite do
|
|||||||
expect(topic.invite_by_email(inviter, 'ICEKING@adventuretime.ooo')).to eq(@invite)
|
expect(topic.invite_by_email(inviter, 'ICEKING@adventuretime.ooo')).to eq(@invite)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'updates timestamp of existing invite' do
|
||||||
|
@invite.created_at = 10.days.ago
|
||||||
|
@invite.save
|
||||||
|
resend_invite = topic.invite_by_email(inviter, 'iceking@adventuretime.ooo')
|
||||||
|
expect(resend_invite.created_at).to be_within(1.minute).of(Time.zone.now)
|
||||||
|
end
|
||||||
|
|
||||||
it 'returns a new invite if the other has expired' do
|
it 'returns a new invite if the other has expired' do
|
||||||
SiteSetting.stubs(:invite_expiry_days).returns(1)
|
SiteSetting.invite_expiry_days = 1
|
||||||
@invite.created_at = 2.days.ago
|
@invite.created_at = 2.days.ago
|
||||||
@invite.save
|
@invite.save
|
||||||
new_invite = topic.invite_by_email(inviter, 'iceking@adventuretime.ooo')
|
new_invite = topic.invite_by_email(inviter, 'iceking@adventuretime.ooo')
|
||||||
|
Loading…
Reference in New Issue
Block a user