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

@ -115,8 +115,9 @@ Router\post_action('refresh-feed', function () {
$feed_id = Request\int_param('feed_id', 0);
Response\json(array(
'feed_id' => $feed_id,
'result' => Handler\Feed\update_feed($user_id, $feed_id),
'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),
));
});

View File

@ -49,7 +49,7 @@
<?php endif ?>
<span class="feed-parsing-error">
<?php echo t('An error occurred during the last check: "%s".', $feed['parsing_error_message']) ?>
<?php echo t('An error occurred during the last check: "%s".', $feed['parsing_error_message']) ?>
</span>
<?php endif ?>

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) {