Skip to content

Commit

Permalink
Merge pull request #4645 from coralproject/feat/CORL-3171-tenor
Browse files Browse the repository at this point in the history
Update Tenor gifs to use the new string based `contentFilter`
  • Loading branch information
tessalt committed Jul 11, 2024
2 parents 583ec80 + bf2e463 commit 8226af4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/src/core/server/app/handlers/api/tenor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,26 @@ interface SearchPayload {

export const convertGiphyContentRatingToTenorLevel = (
rating: string | null | undefined
) => {
): string => {
if (!rating) {
return 1;
return "high";
}

const lowerRating = rating.toLowerCase();
if (lowerRating === "g") {
return 1;
return "high";
}
if (lowerRating === "pg") {
return 2;
return "medium";
}
if (lowerRating === "pg-13") {
return 3;
return "low";
}
if (lowerRating === "r") {
return 4;
return "off";
}

return 1;
return "high";
};

export const tenorSearchHandler =
Expand Down Expand Up @@ -126,7 +126,7 @@ export const tenorSearchHandler =
url.searchParams.set("q", params.query);
url.searchParams.set("key", apiKey);
url.searchParams.set("limit", `${SEARCH_LIMIT}`);
url.searchParams.set("ContentFilter", `${contentFilter}`);
url.searchParams.set("contentfilter", contentFilter);

const response = await fetch(url.toString(), {
method: "GET",
Expand Down

0 comments on commit 8226af4

Please sign in to comment.