From 0f8bf0f8e12b81e4691a09fcfad5977b652ffe41 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 6 Apr 2015 21:10:33 +0200 Subject: [PATCH] Catch "photo not found" in view.php --- src/scripts/build.js | 2 ++ src/scripts/view/main.js | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/scripts/build.js b/src/scripts/build.js index 524678f..64c9aa6 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -195,6 +195,8 @@ build.no_content = function(typ) { break; case 'cog': html += '

No configuration

'; break; + case 'question-mark': html += '

Photo not found

'; + break; } html += ''; diff --git a/src/scripts/view/main.js b/src/scripts/view/main.js index 33b8cfb..543bed8 100644 --- a/src/scripts/view/main.js +++ b/src/scripts/view/main.js @@ -81,6 +81,16 @@ loadPhotoInfo = function(photoID) { api.post('Photo::get', params, function(data) { + if (data==='Warning: Photo private!'|| + data==='Warning: Wrong password!') { + + $('body').append(build.no_content('question-mark')); + $('body').removeClass('view'); + header.dom().remove(); + return false; + + } + /* Set title */ if (!data.title) data.title = 'Untitled';