Allow updating the status of guests from unauthenticated sessions #280

Merged
bustikiller merged 2 commits from guest-update-from-invitation into main 2025-06-12 21:26:01 +00:00
Showing only changes of commit efb5cf64f5 - Show all commits

View File

@ -22,12 +22,6 @@ class GuestsController < ApplicationController
end
def update
if user_signed_in?
permitted_params = guest_params
else
permitted_params = params.expect(guest: %i[status])
end
guest = Guest.find(params[:id]).update!(guest_params)
render json: guest.as_json(GUEST_PARAMS), status: :ok
end
@ -40,6 +34,6 @@ class GuestsController < ApplicationController
private
def guest_params
params.expect(guest: %i[name group_id status])
user_signed_in? ? params.expect(guest: %i[name group_id status]) : params.expect(guest: %i[status])
end
end