From 79980683d1f2eff7c1123b0026844bf6ed3737e3 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Wed, 29 Mar 2017 14:00:57 -0400 Subject: [PATCH] Allow manga +1 button to update both kitsu and mal --- public/js/manga_edit.js | 4 ++-- src/Controller/Manga.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/js/manga_edit.js b/public/js/manga_edit.js index 7fa89a66..e010d681 100644 --- a/public/js/manga_edit.js +++ b/public/js/manga_edit.js @@ -8,7 +8,6 @@ _.on('.manga.list', 'click', '.edit_buttons button', (e) => { let thisSel = e.target; let parentSel = _.closestParent(e.target, 'article'); - let mangaId = parentSel.id.replace('manga-', ''); let type = thisSel.classList.contains('plus_one_chapter') ? 'chapter' : 'volume'; let completed = parseInt(_.$(`.${type}s_read`, parentSel)[0].textContent, 10); let total = parseInt(_.$(`.${type}_count`, parentSel)[0].textContent, 10); @@ -20,7 +19,8 @@ // Setup the update data let data = { - id: mangaId, + id: parentSel.dataset.kitsuId, + mal_id: parentSel.dataset.malId, data: { progress: completed } diff --git a/src/Controller/Manga.php b/src/Controller/Manga.php index e9bc0f01..667dfdda 100644 --- a/src/Controller/Manga.php +++ b/src/Controller/Manga.php @@ -221,7 +221,7 @@ class Manga extends Controller { */ public function update() { - if ($this->request->getHeader('content-type')[0] === 'application/json') + if (stripos($this->request->getHeader('content-type')[0], 'application/json') !== FALSE) { $data = Json::decode((string)$this->request->getBody()); }