Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Update additional search views API params in frontend (#3978)

Olga Bulatab78fee56122
diff --git a/frontend/src/stores/search.ts b/frontend/src/stores/search.ts
index 4d5883d76..c03c6daf2 100644
--- a/frontend/src/stores/search.ts
+++ b/frontend/src/stores/search.ts
@@ -114,8 +114,7 @@ export function computeQueryParams(
return searchQuery
}
-// TODO: After the API changes are done, replace
-// `tags` with `unstable__tag`
+// TODO: Remove `unstable__` parameters after https://github.com/WordPress/openverse/issues/3919
export function buildCollectionQuery(
collectionParams: CollectionParams
): PaginatedCollectionQuery {
@@ -125,10 +124,10 @@ export function buildCollectionQuery(
...params,
...getSensitiveQuery("API"),
unstable__collection: collection,
+ collection,
}
if ("tag" in query) {
- query.tags = query.tag
- delete query.tag
+ query.unstable__tag = query.tag
}
return query
}
diff --git a/frontend/test/tapes/search/images/creator=strogoscope&source=flickr&unstable__collection=creator_keep-alive.json5 b/frontend/test/tapes/search/images/creator=strogoscope&source=flickr&unstable__collection=creator_keep-alive.json5
index c8b2563e2..a8aef6688 100644
--- a/frontend/test/tapes/search/images/creator=strogoscope&source=flickr&unstable__collection=creator_keep-alive.json5
+++ b/frontend/test/tapes/search/images/creator=strogoscope&source=flickr&unstable__collection=creator_keep-alive.json5
@@ -9,7 +9,7 @@
headers: {
connection: 'keep-alive',
},
- url: '/v1/images/?creator=strogoscope&source=flickr&unstable__collection=creator',
+ url: '/v1/images/?creator=strogoscope&source=flickr&unstable__collection=creator&collection=creator',
method: 'GET',
body: '',
},
@@ -1857,4 +1857,4 @@
],
},
},
-}
\ No newline at end of file
+}
diff --git a/frontend/test/tapes/search/images/creator=strogoscope_keep-alive.json5 b/frontend/test/tapes/search/images/creator=strogoscope_keep-alive.json5
index 3a8f2d89d..29221bc47 100644
--- a/frontend/test/tapes/search/images/creator=strogoscope_keep-alive.json5
+++ b/frontend/test/tapes/search/images/creator=strogoscope_keep-alive.json5
@@ -9,7 +9,7 @@
headers: {
connection: 'keep-alive',
},
- url: '/v1/images/?creator=strogoscope%2F+photographer+%3F+creator&source=flickr&unstable__collection=creator',
+ url: '/v1/images/?creator=strogoscope%2F+photographer+%3F+creator&source=flickr&unstable__collection=creator&collection=creator',
method: 'GET',
body: '',
},
@@ -1857,4 +1857,4 @@
],
},
},
-}
\ No newline at end of file
+}
diff --git a/frontend/test/tapes/search/images/source=flickr&unstable__collection=source_keep-alive.json5 b/frontend/test/tapes/search/images/source=flickr&unstable__collection=source_keep-alive.json5
index e9704940a..bd2636b30 100644
--- a/frontend/test/tapes/search/images/source=flickr&unstable__collection=source_keep-alive.json5
+++ b/frontend/test/tapes/search/images/source=flickr&unstable__collection=source_keep-alive.json5
@@ -9,7 +9,7 @@
headers: {
connection: 'keep-alive',
},
- url: '/v1/images/?source=flickr&unstable__collection=source',
+ url: '/v1/images/?source=flickr&unstable__collection=source&collection=source',
method: 'GET',
body: '',
},
@@ -1862,4 +1862,4 @@
],
},
},
-}
\ No newline at end of file
+}
diff --git a/frontend/test/tapes/search/images/unstable__collection=tag&tags=cat_keep-alive.json5 b/frontend/test/tapes/search/images/unstable__collection=tag&tags=cat_keep-alive.json5
index 3f4e45ead..885a8b361 100644
--- a/frontend/test/tapes/search/images/unstable__collection=tag&tags=cat_keep-alive.json5
+++ b/frontend/test/tapes/search/images/unstable__collection=tag&tags=cat_keep-alive.json5
@@ -9,7 +9,7 @@
headers: {
connection: 'keep-alive',
},
- url: '/v1/images/?unstable__collection=tag&tags=cat',
+ url: '/v1/images/?unstable__collection=tag&unstable_tag=cat&collection=tag&tag=cat',
method: 'GET',
body: '',
},
@@ -961,4 +961,4 @@
],
},
},
-}
\ No newline at end of file
+}