From ccc423f6826b5c1ff25457484b02c716d97ca8b4 Mon Sep 17 00:00:00 2001
From: Omar Roth <omarroth@hotmail.com>
Date: Tue, 9 Oct 2018 18:39:19 -0500
Subject: [PATCH] Fix 'latest only' feed

---
 src/invidious.cr | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/invidious.cr b/src/invidious.cr
index 5f7cec7a..5d929996 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -1419,7 +1419,8 @@ get "/feed/subscriptions" do |env|
             id NOT IN (#{watched}) ORDER BY ucid, published DESC",
             user.watched, as: ChannelVideo)
         else
-          videos = PG_DB.query_all("SELECT DISTINCT ON (ucid) * FROM #{view_name}", as: ChannelVideo)
+          videos = PG_DB.query_all("SELECT DISTINCT ON (ucid) * FROM #{view_name} \
+          ORDER BY ucid, published DESC", as: ChannelVideo)
         end
 
         videos.sort_by! { |video| video.published }.reverse!