Update error message when refreshing a feed from user interface

This commit is contained in:
Frederic Guillot 2017-01-03 20:31:12 -05:00
parent c0c77eeed3
commit 2a87847289
4 changed files with 13 additions and 5 deletions

View File

@ -117,6 +117,7 @@ Router\post_action('refresh-feed', function () {
Response\json(array(
'feed_id' => $feed_id,
'result' => Handler\Feed\update_feed($user_id, $feed_id),
'feed' => Model\Feed\get_feed($user_id, $feed_id),
'items_count' => Model\ItemFeed\count_items_by_status($user_id, $feed_id),
));
});

File diff suppressed because one or more lines are too long

View File

@ -25,13 +25,20 @@ Miniflux.Feed = (function() {
feed.removeAttribute("data-feed-error");
var lastChecked = feed.querySelector(".feed-last-checked");
if (lastChecked) lastChecked.innerHTML = lastChecked.getAttribute("data-after-update");
if (lastChecked) {
lastChecked.innerHTML = lastChecked.getAttribute("data-after-update");
}
var response = JSON.parse(this.responseText);
if (response.result) {
itemsCounter.innerHTML = response.items_count.items_unread + "/" + response.items_count.items_total;
} else {
feed.setAttribute("data-feed-error", "1");
var errorMessageElement = feed.querySelector(".feed-parsing-error");
if (errorMessageElement) {
errorMessageElement.innerHTML = response.feed.parsing_error_message;
}
}
if (callback) {