From c14a35f1731861b6278b239220a54639718cc04a Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 17 Jul 2014 03:10:38 +0530 Subject: [PATCH] FIX: If the invite with topic id already exists, redirect user to home page instead --- app/models/invite.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/invite.rb b/app/models/invite.rb index 54b8131a763..fdeb76e0dfc 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -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