mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Remove invalid next/prev in pages sorted by random
This commit is contained in:
parent
9ba7cb1ba5
commit
eaec736676
@ -91,17 +91,20 @@ namespace Kyoo.Abstractions.Models
|
||||
Items = items;
|
||||
This = url + query.ToQueryString();
|
||||
|
||||
if (items.Count > 0 && query.ContainsKey("afterID"))
|
||||
if (!(query.TryGetValue("sortBy", out string? sort) && sort.Contains("random")))
|
||||
{
|
||||
query["afterID"] = items.First().Id.ToString();
|
||||
query["reverse"] = "true";
|
||||
Previous = url + query.ToQueryString();
|
||||
}
|
||||
query.Remove("reverse");
|
||||
if (items.Count == limit && limit > 0)
|
||||
{
|
||||
query["afterID"] = items.Last().Id.ToString();
|
||||
Next = url + query.ToQueryString();
|
||||
if (items.Count > 0 && query.ContainsKey("afterID"))
|
||||
{
|
||||
query["afterID"] = items.First().Id.ToString();
|
||||
query["reverse"] = "true";
|
||||
Previous = url + query.ToQueryString();
|
||||
}
|
||||
query.Remove("reverse");
|
||||
if (items.Count == limit && limit > 0)
|
||||
{
|
||||
query["afterID"] = items.Last().Id.ToString();
|
||||
Next = url + query.ToQueryString();
|
||||
}
|
||||
}
|
||||
|
||||
query.Remove("afterID");
|
||||
|
Loading…
x
Reference in New Issue
Block a user