Skip to content

Commit

Permalink
Merge branch 'main' into rj-coinflow-purchase-vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacsolo committed Jun 10, 2024
2 parents e7060dd + d232cfe commit 1c98290
Show file tree
Hide file tree
Showing 87 changed files with 3,689 additions and 1,248 deletions.
81 changes: 0 additions & 81 deletions .env

This file was deleted.

2 changes: 1 addition & 1 deletion mediorum/.version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.6.121",
"version": "0.6.122",
"service": "content-node"
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "1.5.83",
"version": "1.5.84",
"workspaces": [
"packages/*",
"packages/discovery-provider/plugins/pedalboard/apps/*",
Expand Down
1 change: 0 additions & 1 deletion packages/common/src/models/DogEar.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export enum DogEarType {
STAR = 'star',
HIDDEN = 'hidden',
LOCKED = 'locked',
COLLECTIBLE_GATED = 'collectible gated',
SPECIAL_ACCESS = 'special access',
Expand Down
10 changes: 2 additions & 8 deletions packages/common/src/utils/dogEarUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@ type GetDogEarTypeArgs = {
hasStreamAccess?: boolean
isArtistPick?: boolean
isOwner?: boolean
isUnlisted?: boolean
streamConditions?: Nullable<AccessConditions>
downloadConditions?: Nullable<AccessConditions>
}

/** Determines appropriate DogEar type based on conditions provided. Note: all conditions
/**
* Determines appropriate DogEar type based on conditions provided. Note: all conditions
* are optional. Omitting a condition is effectively ignoring it. This can be used, for example
* to always show gated variants if present by omitting `hasStreamAccess`.
* Behavior:
* * isArtistPick: if true and hasStreamAccess is true, prefers artist pick variant
* * hasStreamAccess: if true, will never return gated variants
* * isOwner: if true, will always return gated variants if present
* * isUnlisted: if true, will always return hidden variant
*/
export const getDogEarType = ({
hasStreamAccess,
isArtistPick,
isOwner,
isUnlisted,
streamConditions,
downloadConditions
}: GetDogEarTypeArgs) => {
Expand Down Expand Up @@ -60,9 +58,5 @@ export const getDogEarType = ({
return DogEarType.STAR
}

if (isUnlisted) {
return DogEarType.HIDDEN
}

return undefined
}
5 changes: 3 additions & 2 deletions packages/ddex/webapp/client/src/pages/Releases/Releases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
TextLink,
OptionsFilterButton
} from '@audius/harmony'

import {
CollectionData,
PaginatedTable
Expand Down Expand Up @@ -110,8 +111,8 @@ const Table = ({ data }: { data: CollectionData }) => {
{item?.sdk_upload_metadata?.title
? 'track'
: item?.sdk_upload_metadata?.playlist_name
? 'album'
: 'unknown'}
? 'album'
: 'unknown'}
</td>
<td>
{item?.sdk_upload_metadata?.artist_id ||
Expand Down
2 changes: 1 addition & 1 deletion packages/discovery-provider/.version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.6.121",
"version": "0.6.122",
"service": "discovery-node"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import logging
import os
import subprocess
import time

from elasticsearch import Elasticsearch

from integration_tests.utils import populate_mock_db
from src.queries.get_top_playlists_es import get_top_playlists_es
from src.utils.db_session import get_db

logger = logging.getLogger(__name__)

esclient = Elasticsearch(os.environ["audius_elasticsearch_url"])

entities = {
"users": [{"user_id": 1}, {"user_id": 2}, {"user_id": 3}],
"follows": [
{"follower_user_id": 1, "followee_user_id": 2},
],
"tracks": [
{"track_id": 1, "owner_id": 2, "genre": "Electronic"},
{"track_id": 2, "owner_id": 3, "genre": "Electronic"},
],
"playlists": [
{
"playlist_id": 1,
"playlist_owner_id": 2,
"playlist_contents": {"track_ids": [{"track": 1, "time": 1}]},
},
{
"playlist_id": 2,
"playlist_owner_id": 3,
"playlist_contents": {"track_ids": [{"track": 2, "time": 2}]},
},
],
}


def setup_db(app):
with app.app_context():
db = get_db()

populate_mock_db(db, entities)

time.sleep(1)
logs = subprocess.run(
["npm", "run", "catchup:ci"],
env=os.environ,
capture_output=True,
text=True,
cwd="es-indexer",
timeout=30,
)
logging.info(logs)
esclient.indices.refresh(index="*")
search_res = esclient.search(index="*", query={"match_all": {}})["hits"]["hits"]
assert len(search_res) == 7


def test_get_top_playlists(app):
setup_db(app)

with app.app_context():
playlists = get_top_playlists_es(
"playlist", {"current_user_id": 1, "limit": 10}
)
# user 1 should see all top playlists
assert len(playlists) == 2
assert playlists[0]["playlist_id"] == 1
assert playlists[1]["playlist_id"] == 2


def test_get_top_followee_playlists(app):
setup_db(app)

with app.app_context():
playlists = get_top_playlists_es(
"playlist", {"current_user_id": 1, "limit": 10, "filter": "followees"}
)
# assert user 1 only sees playlists from who they follow (user 2)
assert len(playlists) == 1
assert playlists[0]["playlist_id"] == 1
Loading

0 comments on commit 1c98290

Please sign in to comment.