• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

codebar / planner / 22035661028

15 Feb 2026 12:27PM UTC coverage: 95.47% (-0.06%) from 95.525%
22035661028

Pull #2483

github

web-flow
Merge c4a4ae827 into 299c366ef
Pull Request #2483: Refactor invitation and workshop sponsor handling

33 of 39 new or added lines in 8 files covered. (84.62%)

3267 of 3422 relevant lines covered (95.47%)

44.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.0
/app/controllers/invitations_controller.rb
1
class InvitationsController < ApplicationController
6✔
2
  before_action :is_logged_in?, only: [:index]
6✔
3
  before_action :set_invitation, only: %i[show attend reject]
6✔
4

5
  def index
6✔
6
    @upcoming_workshop = Workshop.next
1✔
7

8
    upcoming_invitations = WorkshopInvitation.where(member: current_user)
1✔
9
                                             .joins(:workshop)
10
                                             .merge(Workshop.upcoming)
11
                                             .includes(workshop: :chapter)
12
    @upcoming_invitations = InvitationPresenter.decorate_collection(upcoming_invitations)
1✔
13

14
    @attended_invitations = WorkshopInvitation.where(member: current_user)
1✔
15
                                              .attended
16
                                              .includes(workshop: :chapter)
17
  end
18

19
  def show
6✔
20
    @event = EventPresenter.new(@invitation.event)
9✔
21
    @host_address = AddressPresenter.new(@event.venue.address) if @event.venue.present?
9✔
22
    @member = @invitation.member
9✔
23
  end
24

25
  def attend
6✔
26
    event = @invitation.event
4✔
27
    return redirect_back fallback_location: root_path, notice: t('messages.already_rsvped') if @invitation.attending?
4✔
28

29
    if @invitation.student_spaces? || @invitation.coach_spaces?
4✔
30
      @invitation.accept!
4✔
31

32
      notice = t('messages.invitations.spot_confirmed', event: @invitation.event.name)
4✔
33

34
      unless event.confirmation_required || event.surveys_required
4✔
35
        @invitation.verify!
2✔
36
        EventInvitationMailer.attending(@invitation.event, @invitation.member, @invitation).deliver_now
2✔
37
      end
38
      notice = t('messages.invitations.spot_not_confirmed') if event.surveys_required
4✔
39
      redirect_back fallback_location: root_path, notice: notice
4✔
40
    else
41
      email = event.chapters.present? ? event.chapters.first.email : 'hello@codebar.io'
×
42
      redirect_back(
×
43
        fallback_location: root_path,
44
        notice: t('messages.invitations.event.no_available_seats', email: email)
45
      )
46
    end
47
  end
48

49
  def reject
6✔
50
    unless @invitation.attending?
×
51
      return redirect_back(
×
52
        fallback_location: root_path,
53
        notice: t('messages.not_attending_already')
54
      )
55
    end
56

NEW
57
    @invitation.decline!
×
58
    redirect_back(
×
59
      fallback_location: root_path,
60
      notice: t('messages.rejected_invitation', name: @invitation.member.name)
61
    )
62
  end
63

64
  def rsvp_meeting
6✔
65
    return redirect_back fallback_location: root_path, notice: 'Please login first' unless logged_in?
1✔
66

67
    invitation = load_invitation
1✔
68
    meeting = invitation.meeting
1✔
69

70
    if invitation.update(attending: true)
1✔
71
      MeetingInvitationMailer.attending(meeting, current_user).deliver_now
1✔
72
      redirect_to meeting_path(meeting, token: invitation.token),
1✔
73
                  notice: t('messages.invitations.meeting.rsvp')
74
    else
75
      redirect_back fallback_location: root_path, notice: 'Sorry, something went wrong'
×
76
    end
77
  end
78

79
  def cancel_meeting
6✔
80
    @invitation = MeetingInvitation.find_by(token: params[:token])
1✔
81

82
    @invitation.decline!
1✔
83

84
    redirect_back fallback_location: root_path, notice: t('messages.invitations.meeting.cancel')
1✔
85
  end
86

87
  private
6✔
88

89
  def set_invitation
6✔
90
    @invitation = Invitation.find_by(token: params[:token])
13✔
91
  end
92

93
  def load_invitation
6✔
94
    if params[:token].present?
1✔
95
      MeetingInvitation.find_by(token: params[:token], member: current_user)
×
96
    else
97
      meeting = Meeting.find_by(slug: params[:meeting_id])
1✔
98
      MeetingInvitation.new(meeting: meeting, member: current_user, role: 'Participant')
1✔
99
    end
100
  end
101
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc