Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Show onboarding unless invitation present

Zach Gollwitzer455257bf5134
diff --git a/app/controllers/onboardings_controller.rb b/app/controllers/onboardings_controller.rb
index a9869471..bf1ecae2 100644
--- a/app/controllers/onboardings_controller.rb
+++ b/app/controllers/onboardings_controller.rb
@@ -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
diff --git a/app/models/invitation.rb b/app/models/invitation.rb
index 41770b50..625d125e 100644
--- a/app/models/invitation.rb
+++ b/app/models/invitation.rb
@@ -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
diff --git a/test/system/transactions_test.rb b/test/system/transactions_test.rb
index e51c8183..0552db92 100644
--- a/test/system/transactions_test.rb
+++ b/test/system/transactions_test.rb
@@ -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