12 lines
496 B
Ruby
12 lines
496 B
Ruby
# Player-facing match details. Only participants of a match can view it:
|
|
# a non-participant (or an unknown uuid) gets 404 to avoid leaking
|
|
# information about other players' matches.
|
|
class Api::MatchesController < ApplicationController
|
|
def show
|
|
match = Match.for_user(current_user).find_by(uuid: params[:uuid])
|
|
return render json: { error: "Match not found" }, status: :not_found unless match
|
|
|
|
render json: { match: MatchSerializer.as_json(match, viewer: current_user) }
|
|
end
|
|
end
|