Skip to content

Commit

Permalink
fix(Article): attachmentUrl now supports video's preview & thumbnail …
Browse files Browse the repository at this point in the history
…variants
  • Loading branch information
MrOrz committed Feb 28, 2024
1 parent 35bfd67 commit 0a6a7e0
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/graphql/models/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import ArticleReference from 'graphql/models/ArticleReference';
import User, { userFieldResolver } from 'graphql/models/User';
import mediaManager, {
IMAGE_PREVIEW,
VIDEO_PREVIEW,
IMAGE_THUMBNAIL,
VIDEO_THUMBNAIL,
} from 'util/mediaManager';
import ArticleReplyStatusEnum from './ArticleReplyStatusEnum';
import ArticleReply from './ArticleReply';
Expand Down Expand Up @@ -528,17 +530,18 @@ const Article = new GraphQLObjectType({
if (!attachmentHash) return null;

let variant = 'original';
switch (variantArg) {
case 'PREVIEW':
if (articleType === 'IMAGE') {
variant = IMAGE_PREVIEW;
}
switch (`${articleType}_${variantArg}`) {
case 'IMAGE_PREVIEW':
variant = IMAGE_PREVIEW;
break;

case 'THUMBNAIL':
if (articleType === 'IMAGE') {
variant = IMAGE_THUMBNAIL;
}
case 'VIDEO_PREVIEW':
variant = VIDEO_PREVIEW;
break;
case 'IMAGE_THUMBNAIL':
variant = IMAGE_THUMBNAIL;
break;
case 'VIDEO_THUMBNAIL':
variant = VIDEO_THUMBNAIL;
break;
}

Expand Down

0 comments on commit 0a6a7e0

Please sign in to comment.