From 12b4dd9191307c2b3387a4c73c2fc06be5da7703 Mon Sep 17 00:00:00 2001 From: chunky programmer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Sun, 14 May 2023 17:25:32 -0400 Subject: [PATCH 1/2] Populate search bar with ChannelId --- src/invidious/routes/channels.cr | 1 + src/invidious/routes/search.cr | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index d3969d297..740f30961 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -278,6 +278,7 @@ module Invidious::Routes::Channels return error_template(500, ex) end + env.set "search", "channel:" + ucid + " " return {locale, user, subscriptions, continuation, ucid, channel} end end diff --git a/src/invidious/routes/search.cr b/src/invidious/routes/search.cr index 2a9705cf3..7f17124ec 100644 --- a/src/invidious/routes/search.cr +++ b/src/invidious/routes/search.cr @@ -65,7 +65,11 @@ module Invidious::Routes::Search redirect_url = Invidious::Frontend::Misc.redirect_url(env) - env.set "search", query.text + if query.type == Invidious::Search::Query::Type::Channel + env.set "search", "channel:" + query.channel + " " + query.text + else + env.set "search", query.text + end templated "search" end end From 8bd2e60abc42f51e6cdd246e883ab953cabd78ae Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Mon, 22 May 2023 09:19:32 -0400 Subject: [PATCH 2/2] Use string interpolation instead of concatenation Co-authored-by: Samantaz Fox --- src/invidious/routes/channels.cr | 2 +- src/invidious/routes/search.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 740f30961..16621994f 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -278,7 +278,7 @@ module Invidious::Routes::Channels return error_template(500, ex) end - env.set "search", "channel:" + ucid + " " + env.set "search", "channel:#{ucid} " return {locale, user, subscriptions, continuation, ucid, channel} end end diff --git a/src/invidious/routes/search.cr b/src/invidious/routes/search.cr index 7f17124ec..6c3088dee 100644 --- a/src/invidious/routes/search.cr +++ b/src/invidious/routes/search.cr @@ -66,7 +66,7 @@ module Invidious::Routes::Search redirect_url = Invidious::Frontend::Misc.redirect_url(env) if query.type == Invidious::Search::Query::Type::Channel - env.set "search", "channel:" + query.channel + " " + query.text + env.set "search", "channel:#{query.channel} #{query.text}" else env.set "search", query.text end