Merge pull request #2549 from techAPJ/patch-3

FIX: If the invite with topic id already exists, redirect user to home p...
This commit is contained in:
Sam 2014-07-17 08:18:27 +10:00
commit 19d1a9c96b
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) invite = Invite.find_by(invite_key: token)
if invite if invite
invite.update_column(:email, email) 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 user = InviteRedeemer.new(invite, username, name).redeem
end end
user user