Fix provided author for '/videos' endpoint

pull/633/head
Omar Roth 2019-07-02 07:29:01 -05:00
rodzic 501b523680
commit 2df97cd2f5
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B8254FB7EC3D37F2
2 zmienionych plików z 7 dodań i 10 usunięć

Wyświetl plik

@ -2908,7 +2908,7 @@ get "/channel/:ucid" do |env|
sort_options = {"newest", "oldest", "popular"}
sort_by ||= "newest"
items, count = get_60_videos(channel.ucid, page, channel.auto_generated, sort_by)
items, count = get_60_videos(channel.ucid, channel.author, page, channel.auto_generated, sort_by)
items.select! { |item| !item.paid }
env.set "search", "channel:#{channel.ucid} "
@ -3544,7 +3544,7 @@ get "/api/v1/channels/:ucid" do |env|
count = 0
else
begin
videos, count = get_60_videos(channel.ucid, page, channel.auto_generated, sort_by)
videos, count = get_60_videos(channel.ucid, channel.author,page, channel.auto_generated, sort_by)
rescue ex
error_message = {"error" => ex.message}.to_json
env.response.status_code = 500
@ -3669,7 +3669,7 @@ end
end
begin
videos, count = get_60_videos(channel.ucid, page, channel.auto_generated, sort_by)
videos, count = get_60_videos(channel.ucid, channel.author, page, channel.auto_generated, sort_by)
rescue ex
error_message = {"error" => ex.message}.to_json
env.response.status_code = 500
@ -3806,11 +3806,8 @@ get "/api/v1/search" do |env|
search_params = produce_search_params(sort_by, date, content_type, duration, features)
rescue ex
env.response.status_code = 400
next JSON.build do |json|
json.object do
json.field "error", ex.message
end
end
error_message = {"error" => ex.message}.to_json
next error_message
end
count, search_results = search(query, page, search_params, region).as(Tuple)

Wyświetl plik

@ -729,7 +729,7 @@ def get_about_info(ucid, locale)
)
end
def get_60_videos(ucid, page, auto_generated, sort_by = "newest")
def get_60_videos(ucid, author, page, auto_generated, sort_by = "newest")
count = 0
videos = [] of SearchVideo
@ -751,7 +751,7 @@ def get_60_videos(ucid, page, auto_generated, sort_by = "newest")
if auto_generated
videos += extract_videos(nodeset)
else
videos += extract_videos(nodeset, ucid)
videos += extract_videos(nodeset, ucid, author)
end
else
break