Improve status.card normalization (it will never be a string)

This commit is contained in:
Alex Gleason 2022-03-31 14:27:44 -05:00
parent c4dd3c65f9
commit c077a4ea58
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 3 additions and 4 deletions

View File

@ -465,9 +465,8 @@ class Status extends ImmutablePureComponent<IStatus, IStatusState> {
); );
} else if (size === 1 && firstAttachment.type === 'video') { } else if (size === 1 && firstAttachment.type === 'video') {
const video = firstAttachment; const video = firstAttachment;
const html = String(status.getIn(['card', 'html']));
if (video.external_video_id && html) { if (video.external_video_id && status.card) {
const { mediaWrapperWidth } = this.state; const { mediaWrapperWidth } = this.state;
const getHeight = (): number => { const getHeight = (): number => {
@ -484,7 +483,7 @@ class Status extends ImmutablePureComponent<IStatus, IStatusState> {
ref={this.setRef} ref={this.setRef}
className='status-card__image status-card-video' className='status-card__image status-card-video'
style={height ? { height } : undefined} style={height ? { height } : undefined}
dangerouslySetInnerHTML={{ __html: html }} dangerouslySetInnerHTML={{ __html: status.card.html }}
/> />
</div> </div>
); );

View File

@ -25,7 +25,7 @@ export const StatusRecord = ImmutableRecord({
account: null as EmbeddedEntity<Account>, account: null as EmbeddedEntity<Account>,
application: null as ImmutableMap<string, any> | null, application: null as ImmutableMap<string, any> | null,
bookmarked: false, bookmarked: false,
card: null as EmbeddedEntity<Card>, card: null as Card | null,
content: '', content: '',
created_at: new Date(), created_at: new Date(),
emojis: ImmutableList<Emoji>(), emojis: ImmutableList<Emoji>(),