Remove code that is no longer being used.

This commit is contained in:
Guo Xiang Tan 2017-07-11 11:04:29 +09:00
parent 31f7640335
commit c5b1317a15
2 changed files with 0 additions and 29 deletions

View File

@ -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)

View File

@ -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)