Files
MatchLiveTv/backend/app/services/youtube/team_status.rb
Emiliano Frascaro 994c1e3c09 Integrazione YouTube Live: OAuth squadra, canale piattaforma Light e UI.
Collegamento da Dettagli squadra e admin per il refresh token Match Live TV; API e app mobile allineate ai piani Light/Full.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 19:36:56 +02:00

45 lines
858 B
Ruby

module Youtube
class TeamStatus
PLATFORM_LABEL = "Match Live TV".freeze
def initialize(team)
@team = team
@ent = team.entitlements
@mode = @ent.plan.youtube_mode
end
def selectable?
return false unless @ent.youtube_enabled?
case @mode
when "matchlivetv_light"
PlatformCredential.configured?
when "team"
@team.youtube_credential.present?
else
false
end
end
def connected?
selectable?
end
def uses_platform_channel?
@mode == "matchlivetv_light" && PlatformCredential.configured?
end
def channel_title
if uses_platform_channel?
PLATFORM_LABEL
else
@team.youtube_credential&.channel_title
end
end
def needs_team_oauth?
@mode == "team" && @ent.premium_full?
end
end
end