Commit 1bb5f9f9 authored by zhitomirskiyi's avatar zhitomirskiyi

only allow invites if invite count > 0 for current user

parent bc81154c
......@@ -52,6 +52,12 @@ class ServicesController < ApplicationController
end
def inviter
if current_user.invites == 0
flash[:error] = I18n.t 'invitations.create.no_more'
redirect_to :back
return
end
@uid = params[:uid]
if i_id = params[:invitation_id]
......
......@@ -44,5 +44,3 @@
%h4= t('shared.invitations.invite_your_friends')
= render "shared/invitations", :invites => @invites
......@@ -39,7 +39,7 @@
= t('invitations.new.already_invited')
%br
= link_to t('.resend'), service_inviter_path(:uid => uid, :provider => 'facebook', :invitation_id => friend[:invitation_id])
- else
- elsif current_user.invites > 0
= form_tag service_inviter_path do
= select_tag(:aspect_id, options_from_collection_for_select(@all_aspects, 'id', 'name'))
= hidden_field_tag :uid, uid
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment