Skip to content

Commit

Permalink
Show onboarding unless invitation present
Browse files Browse the repository at this point in the history
Fixes #1421
  • Loading branch information
zachgoll committed Nov 6, 2024
1 parent f2739b7 commit 455257b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/controllers/onboardings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def set_user
end

def load_invitation
@invitation = Invitation.accepted.most_recent_for_email(Current.user.email)
@invitation = Current.family.invitations.accepted.find_by(email: Current.user.email)
end
end
1 change: 0 additions & 1 deletion app/models/invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class Invitation < ApplicationRecord

scope :pending, -> { where(accepted_at: nil).where("expires_at > ?", Time.current) }
scope :accepted, -> { where.not(accepted_at: nil) }
scope :most_recent_for_email, ->(email) { where(email: email).order(accepted_at: :desc).first }

def pending?
accepted_at.nil? && expires_at > Time.current
Expand Down
6 changes: 4 additions & 2 deletions test/system/transactions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ class TransactionsTest < ApplicationSystemTestCase
investment_account.entries.create!(name: "Investment account", date: Date.current, amount: 1000, currency: "USD", entryable: Account::Transaction.new)
transfer_date = Date.current
visit account_url(investment_account)
click_on "New"
click_on "New transaction"
within "[data-testid='activity-menu']" do
click_on "New"
click_on "New transaction"
end
select "Deposit", from: "Type"
fill_in "Date", with: transfer_date
fill_in "account_entry[amount]", with: 175.25
Expand Down

0 comments on commit 455257b

Please sign in to comment.