1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-30 10:39:40 +02:00

Show onboarding unless invitation present

Fixes #1421
This commit is contained in:
Zach Gollwitzer 2024-11-05 19:08:45 -05:00
parent f2739b79fb
commit 455257bf51
3 changed files with 5 additions and 4 deletions

View file

@ -19,6 +19,6 @@ class OnboardingsController < ApplicationController
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

View file

@ -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

View file

@ -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)
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