Files
kondiplo_front/app/channels/board_channel.rb
kontei e90ea88758
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled
refactor: BoardAccessible concernを導入し、ボード関連コントローラを整理、ターン表示ロジックをTurnモデルへ移動し、ボード提案表示をコントローラで処理するよう変更
2026-02-19 22:46:24 +09:00

29 lines
688 B
Ruby

class BoardChannel < ApplicationCable::Channel
def subscribed
board = Board.find_by(id: params[:board_id])
unless board
reject
return
end
current_participant = board.game.participants.find_by(user: current_user)
# ゲーム参加者でなければ一律拒否
unless current_participant
reject
return
end
# 権限判定:共通掲示板/公開掲示板/メンバー/履歴モードのいずれかで許可
if board.global? || board.is_public? || board.member?(current_participant) || board.history_mode?
stream_from "board_#{board.id}"
else
reject
end
end
def unsubscribed
# cleanup
end
end