Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Put playlist-artwork generation behind flag (#3640)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Jun 23, 2023
1 parent 2f1f40d commit 6f570c6
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
UserTrackMetadata,
AudiusBackend,
UserCollection,
ID
ID,
FeatureFlags
} from '@audius/common'
import { isEqual } from 'lodash'
import { call, put, select, takeEvery } from 'typed-redux-saga'
Expand Down Expand Up @@ -80,6 +81,11 @@ function* addTrackToPlaylistAsync(action: AddTrackToPlaylistAction) {
const { playlistId, trackId } = action
yield* waitForWrite()
const userId = yield* call(ensureLoggedIn)
const getFeatureEnabled = yield* getContext('getFeatureEnabled')
const isPlaylistImprovementsEnabled = yield* call(
getFeatureEnabled,
FeatureFlags.PLAYLIST_UPDATES_PRE_QA
)
const audiusBackendInstance = yield* getContext('audiusBackendInstance')
const web3 = yield* call(audiusBackendInstance.getWeb3)

Expand All @@ -100,7 +106,12 @@ function* addTrackToPlaylistAsync(action: AddTrackToPlaylistAction) {
const trackOwnerEntities = yield* call(fetchUsers, [track.owner_id])
const trackOwner = trackOwnerEntities.entries[track.owner_id]

if (track && trackOwner && playlist.track_count === 3) {
if (
track &&
trackOwner &&
playlist.track_count === 3 &&
isPlaylistImprovementsEnabled
) {
const trackWithUser = { ...track, user: trackOwner }
const tracks = [...(playlist.tracks ?? []), trackWithUser]
const first4Tracks = tracks.slice(0, 4)
Expand Down

0 comments on commit 6f570c6

Please sign in to comment.