-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CORL-3180]: update to not autoplay tenor gifs in mod queue #4669
Changes from all commits
65e9696
400c4c0
325fa3b
a648c02
6945b13
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { default as MediaContainer } from "./MediaContainer"; | ||
export { default as GiphyMedia } from "./GiphyMedia"; | ||
export { default as GifMedia } from "./GifMedia"; | ||
export { default as TwitterMedia } from "./TwitterMedia"; | ||
export { default as YouTubeMedia } from "./YouTubeMedia"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,14 +4,13 @@ import { graphql } from "react-relay"; | |
import { withFragmentContainer } from "coral-framework/lib/relay"; | ||
import { HorizontalGutter, Timestamp } from "coral-ui/components/v2"; | ||
import ExternalMedia from "../MediaContainer/ExternalMedia"; | ||
import GiphyMedia from "../MediaContainer/GiphyMedia"; | ||
import GifMedia from "../MediaContainer/GifMedia"; | ||
import TwitterMedia from "../MediaContainer/TwitterMedia"; | ||
import YouTubeMedia from "../MediaContainer/YouTubeMedia"; | ||
|
||
import { CommentRevisionContainer_comment as CommentData } from "coral-admin/__generated__/CommentRevisionContainer_comment.graphql"; | ||
|
||
import { CommentContent } from "../Comment"; | ||
import TenorMedia from "../MediaContainer/TenorMedia"; | ||
|
||
interface Props { | ||
comment: CommentData; | ||
|
@@ -33,12 +32,13 @@ const CommentRevisionContainer: FunctionComponent<Props> = ({ comment }) => { | |
<Timestamp>{c.createdAt}</Timestamp> | ||
<CommentContent>{c.body ? c.body : ""}</CommentContent> | ||
{c.media && c.media.__typename === "GiphyMedia" && ( | ||
<GiphyMedia | ||
<GifMedia | ||
still={c.media.still} | ||
video={c.media.video} | ||
title={c.media.title} | ||
width={c.media.width} | ||
height={c.media.height} | ||
url={c.media.url} | ||
/> | ||
)} | ||
{c.media && c.media.__typename === "ExternalMedia" && ( | ||
|
@@ -65,7 +65,14 @@ const CommentRevisionContainer: FunctionComponent<Props> = ({ comment }) => { | |
/> | ||
)} | ||
{c.media && c.media.__typename === "TenorMedia" && ( | ||
<TenorMedia url={c.media.url} title={c.media.title} /> | ||
<GifMedia | ||
still={c.media.tenorStill} | ||
video={c.media.tenorVideo} | ||
title={c.media.title} | ||
width={c.media.width} | ||
height={c.media.height} | ||
url={c.media.url} | ||
/> | ||
)} | ||
</div> | ||
))} | ||
|
@@ -100,6 +107,10 @@ const enhanced = withFragmentContainer<Props>({ | |
... on TenorMedia { | ||
url | ||
title | ||
width | ||
height | ||
tenorStill: still | ||
tenorVideo: video | ||
Comment on lines
+112
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're aliasing these to Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I was trying to keep this consistent with the naming for |
||
} | ||
... on TwitterMedia { | ||
url | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export interface MediaFormat { | ||
url: string; | ||
duration: number; | ||
dims: number[]; | ||
size: number; | ||
} | ||
|
||
export interface SearchResult { | ||
id: string; | ||
title: string; | ||
created: number; | ||
content_description: string; | ||
itemurl: string; | ||
url: string; | ||
tags: string[]; | ||
flags: []; | ||
hasaudio: boolean; | ||
media_formats: { | ||
webm: MediaFormat; | ||
mp4: MediaFormat; | ||
nanowebm: MediaFormat; | ||
loopedmp4: MediaFormat; | ||
gifpreview: MediaFormat; | ||
tinygifpreview: MediaFormat; | ||
nanomp4: MediaFormat; | ||
nanogifpreview: MediaFormat; | ||
tinymp4: MediaFormat; | ||
gif: MediaFormat; | ||
webp: MediaFormat; | ||
mediumgif: MediaFormat; | ||
tinygif: MediaFormat; | ||
nanogif: MediaFormat; | ||
tinywebm: MediaFormat; | ||
}; | ||
} | ||
|
||
export interface SearchPayload { | ||
results: SearchResult[]; | ||
next: string; | ||
} | ||
|
||
export interface FetchPayload { | ||
results: SearchResult[]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import Joi from "joi"; | ||
import fetch from "node-fetch"; | ||
|
||
import { SearchPayload } from "coral-common/common/lib/types/tenor"; | ||
import { AppOptions } from "coral-server/app/"; | ||
import { RequestHandler, TenantCoralRequest } from "coral-server/types/express"; | ||
|
||
|
@@ -17,47 +18,6 @@ interface BodyPayload { | |
pos?: string; | ||
} | ||
|
||
interface MediaFormat { | ||
url: string; | ||
duration: number; | ||
dims: number[]; | ||
size: number; | ||
} | ||
|
||
interface SearchResult { | ||
id: string; | ||
title: string; | ||
created: number; | ||
content_description: string; | ||
itemurl: string; | ||
url: string; | ||
tags: string[]; | ||
flags: []; | ||
hasaudio: boolean; | ||
media_formats: { | ||
webm: MediaFormat; | ||
mp4: MediaFormat; | ||
nanowebm: MediaFormat; | ||
loopedmp4: MediaFormat; | ||
gifpreview: MediaFormat; | ||
tinygifpreview: MediaFormat; | ||
nanomp4: MediaFormat; | ||
nanogifpreview: MediaFormat; | ||
tinymp4: MediaFormat; | ||
gif: MediaFormat; | ||
webp: MediaFormat; | ||
mediumgif: MediaFormat; | ||
tinygif: MediaFormat; | ||
nanogif: MediaFormat; | ||
tinywebm: MediaFormat; | ||
}; | ||
} | ||
|
||
interface SearchPayload { | ||
results: SearchResult[]; | ||
next: string; | ||
} | ||
|
||
export const convertGiphyContentRatingToTenorLevel = ( | ||
rating: string | null | undefined | ||
): string => { | ||
|
@@ -133,6 +93,7 @@ export const tenorSearchHandler = | |
url.searchParams.set("key", apiKey); | ||
url.searchParams.set("limit", `${SEARCH_LIMIT}`); | ||
url.searchParams.set("contentfilter", contentFilter); | ||
url.searchParams.set("media_filter", "gif,nanogif"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this |
||
|
||
if (params.pos) { | ||
url.searchParams.set("pos", params.pos); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the name of this component since it is now used for displaying both Tenor and Giphy gifs.