From b3926efebcc124bc558e29ba2c5ad666d9f52c2e Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 6 Aug 2014 14:02:00 +0530 Subject: [PATCH 1/2] convert space to plus for invite email parameter --- app/controllers/invites_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 32ce8f8f827..433226504cb 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -63,6 +63,7 @@ class InvitesController < ApplicationController def redeem_disposable_invite params.require(:email) params.permit(:username, :name, :topic) + params[:email] = params[:email].split(' ').join('+') invite = Invite.find_by(invite_key: params[:token]) From 262d4b2fa6531fcd916eddefb97109ede1adda2f Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 6 Aug 2014 20:36:06 +0530 Subject: [PATCH 2/2] add test for email parameter fix --- spec/controllers/invites_controller_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb index db757845943..f32359d091e 100644 --- a/spec/controllers/invites_controller_spec.rb +++ b/spec/controllers/invites_controller_spec.rb @@ -252,6 +252,11 @@ describe InvitesController do let(:invitee) { Fabricate(:user) } let(:invite) { Invite.create!(invited_by: invitee) } + it 'converts "space" to "+" in email parameter' do + Invite.expects(:redeem_from_token).with(invite.invite_key, "fname+lname@example.com", nil, nil, topic.id) + get :redeem_disposable_invite, email: "fname lname@example.com", token: invite.invite_key, topic: topic.id + end + it 'redeems the invite' do Invite.expects(:redeem_from_token).with(invite.invite_key, "name@example.com", nil, nil, topic.id) get :redeem_disposable_invite, email: "name@example.com", token: invite.invite_key, topic: topic.id