Unifica admin società/squadre e YouTube Full con fallback MLTV.

Premium Full senza canale società usa il canale piattaforma come Light;
in app restano solo Match Live TV e YouTube Live.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 22:38:28 +02:00
parent 82ff1972a0
commit 9b40deeb61
14 changed files with 125 additions and 144 deletions

View File

@@ -6,19 +6,20 @@ module Youtube
def initialize(team)
@team = team
@status = TeamStatus.new(team)
@mode = team.entitlements.plan.youtube_mode
end
def resolve
if @mode == "matchlivetv_light" && PlatformCredential.configured?
if @status.uses_platform_channel?
PlatformCredential.new
else
elsif @mode == "team"
@team.youtube_credential
end
end
def uses_platform_channel?
@mode == "matchlivetv_light" && PlatformCredential.configured?
@status.uses_platform_channel?
end
end
end

View File

@@ -15,7 +15,7 @@ module Youtube
when "matchlivetv_light"
PlatformCredential.configured?
when "team"
@team.youtube_credential.present?
@team.youtube_credential.present? || PlatformCredential.configured?
else
false
end
@@ -26,7 +26,15 @@ module Youtube
end
def uses_platform_channel?
@mode == "matchlivetv_light" && PlatformCredential.configured?
return false unless @ent.youtube_enabled?
if @mode == "matchlivetv_light"
PlatformCredential.configured?
elsif @mode == "team"
@team.youtube_credential.blank? && PlatformCredential.configured?
else
false
end
end
def channel_title
@@ -38,7 +46,7 @@ module Youtube
end
def needs_team_oauth?
@mode == "team" && @ent.premium_full?
@mode == "team" && @ent.premium_full? && @team.youtube_credential.blank? && !PlatformCredential.configured?
end
end
end