Remove code that is no longer being used.
This commit is contained in:
parent
31f7640335
commit
c5b1317a15
|
@ -218,16 +218,6 @@ class Invite < ActiveRecord::Base
|
|||
invite
|
||||
end
|
||||
|
||||
def self.redeem_from_token(token, email, username=nil, name=nil, topic_id=nil)
|
||||
invite = Invite.find_by(invite_key: token)
|
||||
if invite
|
||||
invite.update_column(:email, email)
|
||||
invite.topic_invites.create!(invite_id: invite.id, topic_id: topic_id) if topic_id && Topic.find_by_id(topic_id) && !invite.topic_invites.pluck(:topic_id).include?(topic_id)
|
||||
user = InviteRedeemer.new(invite, username, name).redeem
|
||||
end
|
||||
user
|
||||
end
|
||||
|
||||
def resend_invite
|
||||
self.update_columns(created_at: Time.zone.now, updated_at: Time.zone.now)
|
||||
Jobs.enqueue(:invite_email, invite_id: self.id)
|
||||
|
|
|
@ -465,25 +465,6 @@ describe Invite do
|
|||
|
||||
end
|
||||
|
||||
describe '.redeem_from_token' do
|
||||
let(:inviter) { Fabricate(:user) }
|
||||
let(:invite) { Fabricate(:invite, invited_by: inviter, email: 'test@example.com', user_id: nil) }
|
||||
let(:user) { Fabricate(:user, email: invite.email) }
|
||||
|
||||
it 'redeems the invite from token' do
|
||||
Invite.redeem_from_token(invite.invite_key, user.email)
|
||||
invite.reload
|
||||
expect(invite).to be_redeemed
|
||||
end
|
||||
|
||||
it 'does not redeem the invite if token does not match' do
|
||||
Invite.redeem_from_token("bae0071f995bb4b6f756e80b383778b5", user.email)
|
||||
invite.reload
|
||||
expect(invite).not_to be_redeemed
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe '.rescind_all_invites_from' do
|
||||
it 'removes all invites sent by a user' do
|
||||
user = Fabricate(:user)
|
||||
|
|
Loading…
Reference in New Issue