bullet_train 1.1.5 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a08595be0c53652a5cd5dfeeb920bc080476a31b180bb4832919398bcb0e2bf0
4
- data.tar.gz: 8132b225ed537f17fd13c17a8d6edc4c99b63712d56cd208a5fda981074e819d
3
+ metadata.gz: e088bbba7d158e14c1bb6f6e573842f90b05b598b480f80210c2a021c6d9755a
4
+ data.tar.gz: 64a3ae2acafde00c0ea3c2f2fdcafbcefa67a43983c2a4b45b5e03c7747a5b85
5
5
  SHA512:
6
- metadata.gz: 2f6b84f79d914c69c184c1e0e8c9213eb0b8a000fcfbdc017768f5876408f99ec4a00c481e14c7f21ff9bc3de9652847c6ca37378e0446e153dbea918494bb94
7
- data.tar.gz: 7d59102fd98d4b0fc7877be50b40285d4ef1597d694242e70b70e4d8807638220bbad1232ada6edafd8ab968767d3012ad78a1f7f2347ef220bf911a7447ce2c
6
+ metadata.gz: f6200ec9cc117de6868a7061a372ba2f6b0641272b8ce183a01e0e94387a4dc8cdfbe4f6a35ee154e713804b230ffcc507e8de0160f46ab09b6a0918222c7f37
7
+ data.tar.gz: a25fcf36a418be54b27cb2b4697ce40697dc78315fbfeede66d6ddc91eca02695dea99b0c9bc65046c8b036d351ce0a91439ca30b932d445891979bda819e95f
@@ -84,16 +84,11 @@ module Account::Memberships::ControllerBase
84
84
  end
85
85
 
86
86
  def reinvite
87
- if helpers.current_limits.can?(:create, Membership)
88
- @invitation = Invitation.new(membership: @membership, team: @team, email: @membership.user_email, from_membership: current_membership)
89
- if @invitation.save
90
- redirect_to [:account, @team, :memberships], notice: I18n.t("account.memberships.notifications.reinvited")
91
- else
92
- redirect_to [:account, @team, :memberships], notice: "There was an error creating the invitation (#{@invitation.errors.full_messages.to_sentence})"
93
- end
87
+ @invitation = Invitation.new(membership: @membership, team: @team, email: @membership.user_email, from_membership: current_membership)
88
+ if @invitation.save
89
+ redirect_to [:account, @team, :memberships], notice: I18n.t("account.memberships.notifications.reinvited")
94
90
  else
95
- flash[:error] = :create_limit
96
- redirect_to [:account, @team, :memberships]
91
+ redirect_to [:account, @team, :memberships], notice: "There was an error creating the invitation (#{@invitation.errors.full_messages.to_sentence})"
97
92
  end
98
93
  end
99
94
 
@@ -1,7 +1,5 @@
1
1
  module Account::TeamsHelper
2
2
  def current_team
3
- # TODO We do not want this to be based on the `current_team_id`.
4
- # TODO We want this to be based on the current resource being loaded.
5
3
  current_user&.current_team
6
4
  end
7
5
 
@@ -79,12 +77,4 @@ module Account::TeamsHelper
79
77
  def can_invite?
80
78
  can?(:create, Invitation.new(team: current_team))
81
79
  end
82
-
83
- def current_limits
84
- @limiter ||= if billing_enabled? && defined?(Billing::Limiter)
85
- Billing::Limiter.new(current_team)
86
- else
87
- Billing::MockLimiter.new(current_team)
88
- end
89
- end
90
80
  end
@@ -31,7 +31,7 @@ module Memberships::Base
31
31
 
32
32
  # TODO Probably we can provide a way for gem packages to define these kinds of extensions.
33
33
  if billing_enabled?
34
- scope :billable, -> { current_and_invited }
34
+ scope :billable, -> { current }
35
35
  end
36
36
  end
37
37
 
@@ -4,10 +4,6 @@ module Records::Base
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- if billing_enabled? && defined?(Billing::UsageSupport)
8
- include Billing::UsageSupport
9
- end
10
-
11
7
  if defined?(Webhooks::Outgoing::IssuingModel)
12
8
  include Webhooks::Outgoing::IssuingModel
13
9
  end
@@ -27,10 +27,6 @@ module Teams::Base
27
27
  if defined?(Billing::Stripe::Subscription)
28
28
  has_many :billing_stripe_subscriptions, class_name: "Billing::Stripe::Subscription", dependent: :destroy, foreign_key: :team_id
29
29
  end
30
-
31
- if defined?(Billing::Usage::TeamSupport)
32
- include Billing::Usage::TeamSupport
33
- end
34
30
  end
35
31
 
36
32
  # validations
@@ -66,12 +62,6 @@ module Teams::Base
66
62
 
67
63
  # TODO Probably we can provide a way for gem packages to define these kinds of extensions.
68
64
  if billing_enabled?
69
- def current_billing_subscription
70
- # If by some bug we have two subscriptions, we want to use the one that existed first.
71
- # The reasoning here is that it's more likely to be on some legacy plan that benefits the customer.
72
- billing_subscriptions.active.order(:created_at).first
73
- end
74
-
75
65
  def needs_billing_subscription?
76
66
  return false if freemium_enabled?
77
67
  billing_subscriptions.active.empty?
@@ -1,7 +1,7 @@
1
1
  <% invitation ||= @invitation %>
2
2
  <% team ||= @team || invitation&.team %>
3
3
  <%= render 'account/teams/breadcrumbs', team: team %>
4
- <%= render 'account/shared/breadcrumb', label: t('memberships.label'), url: [:account, team, :memberships] %>
4
+ <%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, team, :memberships] %>
5
5
  <%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, team, :invitations] %>
6
6
  <% if invitation&.persisted? %>
7
7
  <%= render 'account/shared/breadcrumb', label: invitation.label_string, url: [:account, invitation] %>
@@ -1,51 +1,49 @@
1
1
  <%= form_with(model: [:account, (@team unless invitation.persisted?), invitation], class: 'form', local: true) do |form| %>
2
- <%= render "shared/limits/form", form: form, model: invitation.membership, cancel_path: @cancel_path || account_invitation_path(invitation) do %>
3
- <%= render 'account/shared/forms/errors', form: form %>
2
+ <%= render 'account/shared/forms/errors', form: form %>
4
3
 
5
- <%= render 'shared/fields/email_field', form: form, method: :email, options: {autofocus: true} %>
4
+ <%= render 'shared/fields/email_field', form: form, method: :email, options: {autofocus: true} %>
6
5
 
7
- <%= form.fields_for :membership do |membership_form| %>
8
- <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-6">
9
- <div class="sm:col-span-3">
10
- <%= render 'shared/fields/text_field', form: membership_form, method: :user_first_name %>
11
- </div>
6
+ <%= form.fields_for :membership do |membership_form| %>
7
+ <div class="grid grid-cols-1 gap-y gap-x sm:grid-cols-6">
8
+ <div class="sm:col-span-3">
9
+ <%= render 'shared/fields/text_field', form: membership_form, method: :user_first_name %>
10
+ </div>
12
11
 
13
- <div class="sm:col-span-3">
14
- <%= render 'shared/fields/text_field', form: membership_form, method: :user_last_name %>
15
- </div>
12
+ <div class="sm:col-span-3">
13
+ <%= render 'shared/fields/text_field', form: membership_form, method: :user_last_name %>
16
14
  </div>
17
- <% end %>
15
+ </div>
16
+ <% end %>
18
17
 
19
- <% if can? :manage, @team %>
20
- <%= form.fields_for :membership do |fields| %>
21
- <%= fields.hidden_field :team_id, value: @team.id %>
22
- <div class="space-y-3">
23
- <% Membership.assignable_roles.each do |role| %>
24
- <% if current_membership.can_manage_role?(role) %>
25
- <div class="flex items-top">
26
- <%= fields.check_box :role_ids, {multiple: true, class: "h-4 w-4 text-blue focus:ring-blue-dark border-gray-300 rounded mt-0.5"}, role.id, nil %>
27
- <label for="invitation_membership_attributes_role_ids_<%= role.id %>" class="ml-2 block select-none">
28
- <span><%= t('invitations.form.invite_as', role_key: t("memberships.fields.role_ids.options.#{role.key}.label")) %></span>
29
- <div class="mt-0.5 text-gray-400 font-light leading-normal">
30
- <%= t("memberships.fields.role_ids.options.#{role.key}.description") %>
31
- </div>
32
- </label>
33
- </div>
34
- <% end %>
18
+ <% if can? :manage, @team %>
19
+ <%= form.fields_for :membership do |fields| %>
20
+ <%= fields.hidden_field :team_id, value: @team.id %>
21
+ <div class="space-y-3">
22
+ <% Membership.assignable_roles.each do |role| %>
23
+ <% if current_membership.can_manage_role?(role) %>
24
+ <div class="flex items-top">
25
+ <%= fields.check_box :role_ids, {multiple: true, class: "h-4 w-4 text-blue focus:ring-blue-dark border-gray-300 rounded mt-0.5"}, role.id, nil %>
26
+ <label for="invitation_membership_attributes_role_ids_<%= role.id %>" class="ml-2 block select-none">
27
+ <span><%= t('invitations.form.invite_as', role_key: t("memberships.fields.role_ids.options.#{role.key}.label")) %></span>
28
+ <div class="mt-0.5 text-gray-400 font-light leading-normal">
29
+ <%= t("memberships.fields.role_ids.options.#{role.key}.description") %>
30
+ </div>
31
+ </label>
32
+ </div>
35
33
  <% end %>
36
- </div>
37
- <% end %>
34
+ <% end %>
35
+ </div>
38
36
  <% end %>
37
+ <% end %>
39
38
 
40
- <%# 🚅 super scaffolding will insert new fields above this line. %>
39
+ <%# 🚅 super scaffolding will insert new fields above this line. %>
41
40
 
42
- <div class="buttons">
43
- <%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
44
- <% if form.object.persisted? %>
45
- <%= link_to t('global.buttons.cancel'), account_invitation_path(invitation), class: "button-secondary" %>
46
- <% else %>
47
- <%= link_to t('global.buttons.cancel'), @cancel_path || account_team_invitations_path(@team), class: "button-secondary" %>
48
- <% end %>
49
- </div>
50
- <% end %>
41
+ <div class="buttons">
42
+ <%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
43
+ <% if form.object.persisted? %>
44
+ <%= link_to t('global.buttons.cancel'), account_invitation_path(invitation), class: "button-secondary" %>
45
+ <% else %>
46
+ <%= link_to t('global.buttons.cancel'), @cancel_path || account_team_invitations_path(@team), class: "button-secondary" %>
47
+ <% end %>
48
+ </div>
51
49
  <% end %>
@@ -42,4 +42,5 @@
42
42
  <%= form.submit t('.buttons.update'), class: "button" %>
43
43
  <%= link_to t('global.buttons.cancel'), [:account, @team, :memberships], class: "button-secondary" %>
44
44
  </div>
45
+
45
46
  <% end %>
@@ -2,68 +2,65 @@
2
2
  <% hide_actions ||= false %>
3
3
  <% hide_back ||= false %>
4
4
 
5
- <%= updates_for context, :memberships do %>
6
- <%= render 'account/shared/box' do |p| %>
7
- <% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
8
- <% p.content_for :description do %>
9
- <%= raw t(".contexts.#{context.class.name.underscore}.#{memberships.any? ? 'description' : 'description_empty'}") %>
10
- <%= render "shared/limits/index", model: memberships.model %>
11
- <% end %>
5
+ <%= render 'account/shared/box' do |p| %>
6
+ <% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
7
+ <% p.content_for :description do %>
8
+ <%= raw t(".contexts.#{context.class.name.underscore}.#{memberships.any? ? 'description' : 'description_empty'}") %>
9
+ <% end %>
12
10
 
13
- <% p.content_for :table do %>
14
- <% if memberships.any? %>
15
- <table class="table">
16
- <thead>
17
- <tr>
18
- <th><%= t('memberships.singular') %></th>
19
- <th><%= t('memberships.fields.role_ids.heading') %></th>
20
- <%# 🚅 super scaffolding will insert new field headers above this line. %>
21
- <th></th>
22
- </tr>
23
- </thead>
24
- <tbody data-model="Membership" data-scope="current">
25
- <% memberships.each do |membership| %>
26
- <tr data-id="<%= membership.id %>">
11
+ <% p.content_for :table do %>
12
+ <% if memberships.any? %>
13
+ <table class="table">
14
+ <thead>
15
+ <tr>
16
+ <th><%= t('memberships.singular') %></th>
17
+ <th><%= t('memberships.fields.role_ids.heading') %></th>
18
+ <%# 🚅 super scaffolding will insert new field headers above this line. %>
19
+ <th></th>
20
+ </tr>
21
+ </thead>
22
+ <tbody data-model="Membership" data-scope="current">
23
+ <% memberships.each do |membership| %>
24
+ <tr data-id="<%= membership.id %>">
27
25
 
28
- <td class="px-6 py-4 whitespace-nowrap">
29
- <%= link_to [:account, membership], class: 'block flex items-center group hover:no-underline no-underline' do %>
30
- <div class="flex-shrink-0 h-10 w-10">
31
- <%= image_tag membership_profile_photo_url(membership), title: membership.label_string, class: 'h-10 w-10 rounded-full' %>
32
- </div>
26
+ <td class="px-6 py-4 whitespace-nowrap">
27
+ <%= link_to [:account, membership], class: 'block flex items-center group hover:no-underline no-underline' do %>
28
+ <div class="flex-shrink-0 h-10 w-10">
29
+ <%= image_tag membership_profile_photo_url(membership), title: membership.label_string, class: 'h-10 w-10 rounded-full' %>
30
+ </div>
33
31
 
34
- <div class="ml-3">
35
- <span class="group-hover:underline"><%= membership.label_string %></span>
36
- <% if membership.unclaimed? %>
37
- <span class="ml-1.5 px-2 inline-flex text-xs text-green-dark bg-green-light border border-green-dark rounded-md">
38
- Invited
39
- </span>
40
- <% end %>
41
- </div>
42
- <% end %>
43
- </td>
32
+ <div class="ml-3">
33
+ <span class="group-hover:underline"><%= membership.label_string %></span>
34
+ <% if membership.unclaimed? %>
35
+ <span class="ml-1.5 px-2 inline-flex text-xs text-green-dark bg-green-light border border-green-dark rounded-md">
36
+ Invited
37
+ </span>
38
+ <% end %>
39
+ </div>
40
+ <% end %>
41
+ </td>
44
42
 
45
- <td>
46
- <% if membership.roles_without_defaults.any? %>
47
- <%= membership.roles_without_defaults.map { |role| t("memberships.fields.role_ids.options.#{role.key}.label") }.to_sentence %>
48
- <% else %>
49
- <%= t("memberships.fields.role_ids.options.default.label") %>
50
- <% end %>
51
- </td>
52
- <td class="text-right">
53
- <%= link_to t('.buttons.show'), [:account, membership], class: 'button-secondary button-smaller' %>
54
- </td>
55
- </tr>
56
- <% end %>
57
- </tbody>
58
- </table>
59
- <% end %>
43
+ <td>
44
+ <% if membership.roles_without_defaults.any? %>
45
+ <%= membership.roles_without_defaults.map { |role| t("memberships.fields.role_ids.options.#{role.key}.label") }.to_sentence %>
46
+ <% else %>
47
+ <%= t("memberships.fields.role_ids.options.default.label") %>
48
+ <% end %>
49
+ </td>
50
+ <td class="text-right">
51
+ <%= link_to t('.buttons.show'), [:account, membership], class: 'button-secondary button-smaller' %>
52
+ </td>
53
+ </tr>
54
+ <% end %>
55
+ </tbody>
56
+ </table>
60
57
  <% end %>
58
+ <% end %>
61
59
 
62
- <% unless hide_actions %>
63
- <% p.content_for :actions do %>
64
- <%= link_to t('invitations.buttons.new'), new_account_team_invitation_path(@team, cancel_path: account_team_memberships_path(@team)), class: "#{first_button_primary}" %>
65
- <%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary} back" unless hide_back %>
66
- <% end %>
60
+ <% unless hide_actions %>
61
+ <% p.content_for :actions do %>
62
+ <%= link_to t('invitations.buttons.new'), new_account_team_invitation_path(@team, cancel_path: account_team_memberships_path(@team)), class: "#{first_button_primary}" %>
63
+ <%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary} back" unless hide_back %>
67
64
  <% end %>
68
65
  <% end %>
69
66
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.1.5"
2
+ VERSION = "1.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
@@ -483,7 +483,6 @@ files:
483
483
  - app/mailers/concerns/mailers/base.rb
484
484
  - app/mailers/devise_mailer.rb
485
485
  - app/mailers/user_mailer.rb
486
- - app/models/billing/mock_limiter.rb
487
486
  - app/models/concerns/current_attributes/base.rb
488
487
  - app/models/concerns/invitations/base.rb
489
488
  - app/models/concerns/memberships/base.rb
@@ -1,9 +0,0 @@
1
- class Billing::MockLimiter
2
- def broken_hard_limits_for(action, model, count: 1)
3
- []
4
- end
5
-
6
- def can?(action, model)
7
- true
8
- end
9
- end