This commit is contained in:
User
2025-02-07 18:24:52 -05:00
parent 75d4a616dd
commit b7f9b0aff7
17 changed files with 304 additions and 245 deletions

View File

@@ -59,6 +59,21 @@ class ComicController extends Controller
return str_replace(array_keys($this->zhConversion::ZH_TO_HANT), array_values($this->zhConversion::ZH_TO_HANT), $string);
}
public function toggleHistory(Request $request): JsonResponse
{
if ($request->session()->has('historyDisabled')) {
$newValue = !$request->session()->get('historyDisabled');
} else {
$newValue = true;
}
// Put Session
$request->session()->put('historyDisabled', $newValue);
// Return to frontend
return response()->json(['historyDisabled' => $newValue]);
}
/**
* Show user favourites
*
@@ -323,7 +338,9 @@ class ComicController extends Controller
ImageUpsert::dispatch($comicObj->id, $chapterObj->id, $chapter);
// Update history
$request->user()->readingHistories()->attach($chapterObj->id, ['comic_id' => $comicObj->id]);
if (!$request->session()->get('historyDisabled', false)) {
$request->user()->readingHistories()->attach($chapterObj->id, ['comic_id' => $comicObj->id]);
}
// Get chapters from DB
$chapters = $comicObj->chapters()->where('metadata->group_path_word', $chapter['chapter']['group_path_word'])->orderBy('order')->get(['name', 'chapter_uuid']);