mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Supress max page error on bookmark api and just adjust the pages for the user. (#445)
# Changed - Changed: Suppress max page error on bookmark api and just adjust the pages for the user.
This commit is contained in:
parent
b9f20f4d19
commit
55dd9e7f1e
@ -241,17 +241,18 @@ namespace API.Controllers
|
|||||||
var chapter = await _unitOfWork.VolumeRepository.GetChapterAsync(bookmarkDto.ChapterId);
|
var chapter = await _unitOfWork.VolumeRepository.GetChapterAsync(bookmarkDto.ChapterId);
|
||||||
if (bookmarkDto.PageNum > chapter.Pages)
|
if (bookmarkDto.PageNum > chapter.Pages)
|
||||||
{
|
{
|
||||||
return BadRequest("Can't bookmark past max pages");
|
bookmarkDto.PageNum = chapter.Pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bookmarkDto.PageNum < 0)
|
if (bookmarkDto.PageNum < 0)
|
||||||
{
|
{
|
||||||
return BadRequest("Can't bookmark less than 0");
|
bookmarkDto.PageNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// TODO: Look into creating a progress entry when a new item is added to the DB so we can just look it up and modify it
|
||||||
user.Progresses ??= new List<AppUserProgress>();
|
user.Progresses ??= new List<AppUserProgress>();
|
||||||
var userProgress =
|
var userProgress =
|
||||||
user.Progresses.SingleOrDefault(x => x.ChapterId == bookmarkDto.ChapterId && x.AppUserId == user.Id);
|
user.Progresses.SingleOrDefault(x => x.ChapterId == bookmarkDto.ChapterId && x.AppUserId == user.Id);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Company>kavitareader.com</Company>
|
<Company>kavitareader.com</Company>
|
||||||
<Product>Kavita</Product>
|
<Product>Kavita</Product>
|
||||||
<AssemblyVersion>0.4.3.5</AssemblyVersion>
|
<AssemblyVersion>0.4.3.6</AssemblyVersion>
|
||||||
<NeutralLanguage>en</NeutralLanguage>
|
<NeutralLanguage>en</NeutralLanguage>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user