FIX: If the invite with topic id already exists, redirect user to home page instead

This commit is contained in:
Arpit Jalan 2014-07-17 03:10:38 +05:30
parent f43293a7bc
commit c14a35f173
1 changed files with 1 additions and 1 deletions

View File

@ -172,7 +172,7 @@ class Invite < ActiveRecord::Base
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.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