app/controllers/concerns/account/memberships/controller_base.rb in bullet_train-1.1.6 vs app/controllers/concerns/account/memberships/controller_base.rb in bullet_train-1.1.7
- old
+ new
@@ -82,14 +82,19 @@
rescue RemovingLastTeamAdminException
redirect_to account_team_memberships_path(@team), alert: I18n.t("memberships.notifications.cant_remove")
end
def reinvite
- @invitation = Invitation.new(membership: @membership, team: @team, email: @membership.user_email, from_membership: current_membership)
- if @invitation.save
- redirect_to [:account, @team, :memberships], notice: I18n.t("account.memberships.notifications.reinvited")
+ if helpers.current_limits.can?(:create, Membership)
+ @invitation = Invitation.new(membership: @membership, team: @team, email: @membership.user_email, from_membership: current_membership)
+ if @invitation.save
+ redirect_to [:account, @team, :memberships], notice: I18n.t("account.memberships.notifications.reinvited")
+ else
+ redirect_to [:account, @team, :memberships], notice: "There was an error creating the invitation (#{@invitation.errors.full_messages.to_sentence})"
+ end
else
- redirect_to [:account, @team, :memberships], notice: "There was an error creating the invitation (#{@invitation.errors.full_messages.to_sentence})"
+ flash[:error] = :create_limit
+ redirect_to [:account, @team, :memberships]
end
end
private