From c5b1317a15c6f7b7f11ae61eb0d8fc5c03492740 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 11 Jul 2017 11:04:29 +0900 Subject: [PATCH] Remove code that is no longer being used. --- app/models/invite.rb | 10 ---------- spec/models/invite_spec.rb | 19 ------------------- 2 files changed, 29 deletions(-) diff --git a/app/models/invite.rb b/app/models/invite.rb index 9925b335b36..7f7455fa91f 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -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) diff --git a/spec/models/invite_spec.rb b/spec/models/invite_spec.rb index bf6288e3c3b..c83f689d0f4 100644 --- a/spec/models/invite_spec.rb +++ b/spec/models/invite_spec.rb @@ -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)