Skip to content

Commit 732bf33

Browse files
committed
Fix invitation resend logic to correctly check last sent timestamp
1 parent 4078e65 commit 732bf33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/controllers/better_together/events/invitations_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def invitation_params
110110

111111
def notify_invitee(invitation) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
112112
# Simple throttling: skip if sent in last 15 minutes
113-
if invitation.last_sent.present? && invitation.last_sent > 15.minutes.ago
113+
if invitation.last_sent.present? && invitation.last_sent < 15.minutes.ago
114114
Rails.logger.info("Invitation #{invitation.id} recently sent; skipping resend")
115115
return
116116
end
@@ -122,7 +122,7 @@ def notify_invitee(invitation) # rubocop:todo Metrics/AbcSize, Metrics/MethodLen
122122
invitation.update_column(:last_sent, Time.zone.now)
123123
elsif invitation.for_email?
124124
# Send email directly to external email address (bypassing notification system)
125-
BetterTogether::EventInvitationsMailer.invite(invitation).deliver_later
125+
BetterTogether::EventInvitationsMailer.with(invitation:).invite.deliver_later
126126
invitation.update_column(:last_sent, Time.zone.now)
127127
end
128128
end

0 commit comments

Comments
 (0)