From 667abe7480b04161ec10cf00fffad17accdf23a0 Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 24 Aug 2013 16:51:32 +0200 Subject: [PATCH] Don't nuke DataBoards when threads.json 404s, as 4chan fucks up often. --- src/General/DataBoard.coffee | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/General/DataBoard.coffee b/src/General/DataBoard.coffee index 7939f7d57..066b599c1 100644 --- a/src/General/DataBoard.coffee +++ b/src/General/DataBoard.coffee @@ -70,18 +70,15 @@ class DataBoard @save() ajaxClean: (boardID) -> $.cache "//api.4chan.org/#{boardID}/threads.json", (e) => - if e.target.status is 404 - # Deleted board. - @delete boardID - else if e.target.status is 200 - board = @data.boards[boardID] - threads = {} - for page in JSON.parse e.target.response - for thread in page.threads - if thread.no of board - threads[thread.no] = board[thread.no] - @data.boards[boardID] = threads - @deleteIfEmpty {boardID} + return if e.target.status isnt 200 + board = @data.boards[boardID] + threads = {} + for page in JSON.parse e.target.response + for thread in page.threads + if thread.no of board + threads[thread.no] = board[thread.no] + @data.boards[boardID] = threads + @deleteIfEmpty {boardID} @save() onSync: (data) =>