From 54180acf9b4e2f26152568324515c544b48ba4e6 Mon Sep 17 00:00:00 2001 From: bdharrington7 Date: Wed, 22 Jul 2015 06:55:48 +0800 Subject: [PATCH] saves updated bookmark in callback --- public/src/client/topic.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/public/src/client/topic.js b/public/src/client/topic.js index f2e1b0bab4..858c3d7fd3 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -208,10 +208,19 @@ define('forum/topic', [ 'uid': app.user.uid, 'postIndex': postIndex } - socket.emit('topics.bookmark', data); + socket.emit('topics.bookmark', data, function(err) { + if (err) { + console.warn('Error saving bookmark:', err); + } + ajaxify.data.bookmark = postIndex; + }); } else { localStorage.setItem(bookmarkKey, postIndex); } + } + + // removes the bookmark alert when we get to / past the bookmark + if (!currentBookmark || parseInt(postIndex, 10) >= parseInt(currentBookmark, 10)) { app.removeAlert('bookmark'); }