summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@protonmail.com>2019-05-26 11:34:08 -0500
committerOmar Roth <omarroth@protonmail.com>2019-05-26 11:34:08 -0500
commitbb1ed902a915fba74eed214e60d5f896194ca531 (patch)
treeca39fbb0a9dc59a742d6b62114b08e20fc33c04a
parentb016a60a7521fe28c14af1ea1af6e2e182e81464 (diff)
downloadinvidious-bb1ed902a915fba74eed214e60d5f896194ca531.tar.gz
invidious-bb1ed902a915fba74eed214e60d5f896194ca531.tar.bz2
invidious-bb1ed902a915fba74eed214e60d5f896194ca531.zip
Trigger feed update when modifying subscriptions
-rw-r--r--src/invidious.cr23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 3758713c..370aecbc 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -1700,6 +1700,12 @@ post "/subscription_ajax" do |env|
PG_DB.exec("UPDATE users SET subscriptions = array_remove(subscriptions,$1) WHERE email = $2", channel_id, email)
end
+ payload = {
+ "email" => user.email,
+ "action" => "refresh",
+ }.to_json
+ PG_DB.exec("NOTIFY feeds, E'#{payload}'")
+
if redirect
env.redirect referer
else
@@ -1945,6 +1951,12 @@ post "/data_control" do |env|
end
end
end
+
+ payload = {
+ "email" => user.email,
+ "action" => "refresh",
+ }.to_json
+ PG_DB.exec("NOTIFY feeds, E'#{payload}'")
end
env.redirect referer
@@ -4490,6 +4502,12 @@ post "/api/v1/auth/subscriptions/:ucid" do |env|
if !user.subscriptions.includes? ucid
get_channel(ucid, PG_DB, false, false)
PG_DB.exec("UPDATE users SET subscriptions = array_append(subscriptions,$1) WHERE email = $2", ucid, user.email)
+
+ payload = {
+ "email" => user.email,
+ "action" => "refresh",
+ }.to_json
+ PG_DB.exec("NOTIFY feeds, E'#{payload}'")
end
# For Google accounts, access tokens don't have enough information to
@@ -4506,6 +4524,11 @@ delete "/api/v1/auth/subscriptions/:ucid" do |env|
ucid = env.params.url["ucid"]
PG_DB.exec("UPDATE users SET subscriptions = array_remove(subscriptions,$1) WHERE email = $2", ucid, user.email)
+ payload = {
+ "email" => user.email,
+ "action" => "refresh",
+ }.to_json
+ PG_DB.exec("NOTIFY feeds, E'#{payload}'")
env.response.status_code = 204
end