Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/workshop_invitation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class WorkshopInvitationController < ApplicationController
# CSRF is redundant and fails when browsers withhold the session cookie
# (e.g. Safari/WebKit ITP on cross-site navigation). Same rationale as
# FeedbackController#submit (PR #2641, Rollbar #535).
skip_forgery_protection only: %i[update accept]
skip_forgery_protection only: %i[update accept reject]

def show
@announcements = @invitation.member.announcements.active
Expand Down
12 changes: 12 additions & 0 deletions spec/controllers/workshop_invitation_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,18 @@
end
end

context 'without a session (the invitation token is the only credential)' do
include_context 'with forgery protection enforced'

before { LoginHelpers::LoginStub.current_user = nil }

it 'still rejects the RSVP with the token alone' do
post :reject, params: { id: invitation.token }

expect(invitation.reload.attending).to be false
end
end

context 'when someone is on waiting list' do
let(:waitlisted_member) { Fabricate(:member) }
let(:waitlisted_invitation) { Fabricate(:workshop_invitation, workshop:, member: waitlisted_member, role: 'Student') }
Expand Down
Loading