mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Clean useless database arguments (5/5)
This commit is contained in:
parent
d74873fed1
commit
302fecbdcb
4 changed files with 4 additions and 6 deletions
|
@ -1,5 +1,3 @@
|
||||||
require "db"
|
|
||||||
|
|
||||||
# See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
|
# See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
|
||||||
def ci_lower_bound(pos, n)
|
def ci_lower_bound(pos, n)
|
||||||
if n == 0
|
if n == 0
|
||||||
|
|
|
@ -44,7 +44,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||||
page = env.params.query["page"]?.try &.to_i?
|
page = env.params.query["page"]?.try &.to_i?
|
||||||
page ||= 1
|
page ||= 1
|
||||||
|
|
||||||
videos, notifications = get_subscription_feed(PG_DB, user, max_results, page)
|
videos, notifications = get_subscription_feed(user, max_results, page)
|
||||||
|
|
||||||
JSON.build do |json|
|
JSON.build do |json|
|
||||||
json.object do
|
json.object do
|
||||||
|
|
|
@ -94,7 +94,7 @@ module Invidious::Routes::Feeds
|
||||||
page = env.params.query["page"]?.try &.to_i?
|
page = env.params.query["page"]?.try &.to_i?
|
||||||
page ||= 1
|
page ||= 1
|
||||||
|
|
||||||
videos, notifications = get_subscription_feed(PG_DB, user, max_results, page)
|
videos, notifications = get_subscription_feed(user, max_results, page)
|
||||||
|
|
||||||
# "updated" here is used for delivering new notifications, so if
|
# "updated" here is used for delivering new notifications, so if
|
||||||
# we know a user has looked at their feed e.g. in the past 10 minutes,
|
# we know a user has looked at their feed e.g. in the past 10 minutes,
|
||||||
|
@ -234,7 +234,7 @@ module Invidious::Routes::Feeds
|
||||||
|
|
||||||
params = HTTP::Params.parse(env.params.query["params"]? || "")
|
params = HTTP::Params.parse(env.params.query["params"]? || "")
|
||||||
|
|
||||||
videos, notifications = get_subscription_feed(PG_DB, user, max_results, page)
|
videos, notifications = get_subscription_feed(user, max_results, page)
|
||||||
|
|
||||||
XML.build(indent: " ", encoding: "UTF-8") do |xml|
|
XML.build(indent: " ", encoding: "UTF-8") do |xml|
|
||||||
xml.element("feed", "xmlns:yt": "http://www.youtube.com/xml/schemas/2015",
|
xml.element("feed", "xmlns:yt": "http://www.youtube.com/xml/schemas/2015",
|
||||||
|
|
|
@ -220,7 +220,7 @@ def subscribe_ajax(channel_id, action, env_headers)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_subscription_feed(db, user, max_results = 40, page = 1)
|
def get_subscription_feed(user, max_results = 40, page = 1)
|
||||||
limit = max_results.clamp(0, MAX_ITEMS_PER_PAGE)
|
limit = max_results.clamp(0, MAX_ITEMS_PER_PAGE)
|
||||||
offset = (page - 1) * limit
|
offset = (page - 1) * limit
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue