Skip to content

Commit

Permalink
Return remixes for premium tracks (#6840)
Browse files Browse the repository at this point in the history
Co-authored-by: Saliou Diallo <saliou@audius.co>
  • Loading branch information
sddioulde and Saliou Diallo authored Dec 4, 2023
1 parent 7089475 commit 942fcb8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion packages/discovery-provider/src/queries/get_remixes_of.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ def get_unpopulated_remixes():

parent_track = parent_track_res[0]

if parent_track["is_premium"]:
# Return empty list of remixes if track is gated on conditions other than USDC purchase
if (
parent_track["is_premium"]
and "usdc_purchase" not in parent_track["premium_conditions"]
):
return ([], [], 0)

track_owner_id = parent_track["owner_id"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export const RemixSettingsField = () => {
premiumConditions
])

const isUSDCPurchaseGated = isPremiumContentUSDCPurchaseGated(premiumConditions)
const isUSDCPurchaseGated =
isPremiumContentUSDCPurchaseGated(premiumConditions)

// If the track is public or usdc purchase gated, default to showing remixes.
// Otherwise, default to hiding remixes.
Expand All @@ -102,7 +103,7 @@ export const RemixSettingsField = () => {
} else if (isPremium) {
setShowRemixes(false)
}
}, [isPremium, isUSDCPurchaseGated])
}, [isPremium, isUSDCPurchaseGated, setShowRemixes])

const handleSubmit = useCallback(
(values: RemixSettingsFormValues) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const RemixSettingsMenuFields = () => {

const [, , { setValue: setParentTrackId }] = useField('parentTrackId')

const isUSDCPurchaseGated = isPremiumContentUSDCPurchaseGated(premiumConditions)
const isUSDCPurchaseGated =
isPremiumContentUSDCPurchaseGated(premiumConditions)

useEffect(() => {
setParentTrackId(trackId)
Expand All @@ -75,10 +76,11 @@ export const RemixSettingsMenuFields = () => {
if (isPremium && !isUSDCPurchaseGated) {
return (
<HelpCallout
content={`${messages.changeAvailabilityPrefix} ${isPremiumContentCollectibleGated(premiumConditions)
? messages.collectibleGated
: messages.specialAccess
}${messages.changeAvailabilitySuffix}`}
content={`${messages.changeAvailabilityPrefix} ${
isPremiumContentCollectibleGated(premiumConditions)
? messages.collectibleGated
: messages.specialAccess
}${messages.changeAvailabilitySuffix}`}
/>
)
}
Expand Down

0 comments on commit 942fcb8

Please sign in to comment.