fix setting the duration (fixes #240)

This commit is contained in:
teddit 2021-09-12 18:03:00 +02:00
parent 0707349a85
commit 9e515c4985
1 changed files with 7 additions and 1 deletions

View File

@ -28,8 +28,14 @@ async function fromJson(data, user_preferences, subreddit_front) {
result.domain = data.domain result.domain = data.domain
result.is_video = data.is_video result.is_video = data.is_video
result.media = data.media result.media = data.media
result.duration = data.is_video ? data.media.reddit_video ? data.media.reddit_video.duration : void 0 : void 0 result.duration = null
result.images = null result.images = null
if(data.is_video && data.media) {
if(data.media.reddit_video) {
result.duration = data.media.reddit_video.duration
}
}
// Moderation attributes // Moderation attributes
result.locked = data.locked result.locked = data.locked