fix 5161 by checking recommended videos published field for presence instead of just not nil

This commit is contained in:
Drikanis 2025-01-28 19:40:15 -07:00
parent 164d764d55
commit 29219c46a1

View File

@ -268,7 +268,7 @@ module Invidious::JSONify::APIv1
json.field "viewCountText", rv["short_view_count"]? json.field "viewCountText", rv["short_view_count"]?
json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64 json.field "viewCount", rv["view_count"]?.try &.empty? ? nil : rv["view_count"].to_i64
json.field "published", rv["published"]? json.field "published", rv["published"]?
if !rv["published"]?.nil? if rv["published"]?.try &.presence
json.field "publishedText", translate(locale, "`x` ago", recode_date(Time.parse_rfc3339(rv["published"].to_s), locale)) json.field "publishedText", translate(locale, "`x` ago", recode_date(Time.parse_rfc3339(rv["published"].to_s), locale))
else else
json.field "publishedText", "" json.field "publishedText", ""