From 0fdb7146419dc8ac247a38ace1161e0245d58296 Mon Sep 17 00:00:00 2001 From: Athou Date: Wed, 22 May 2013 16:10:50 +0200 Subject: [PATCH] display next refresh date --- .../frontend/model/Subscription.java | 24 +++++++++++++++---- src/main/resources/i18n/en.properties | 2 ++ src/main/webapp/js/filters.js | 6 ++++- .../webapp/templates/feeds.feed_details.html | 7 ++++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/commafeed/frontend/model/Subscription.java b/src/main/java/com/commafeed/frontend/model/Subscription.java index 6406f712..b357d00d 100644 --- a/src/main/java/com/commafeed/frontend/model/Subscription.java +++ b/src/main/java/com/commafeed/frontend/model/Subscription.java @@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; +import com.commafeed.backend.model.Feed; import com.commafeed.backend.model.FeedCategory; import com.commafeed.backend.model.FeedSubscription; import com.wordnik.swagger.annotations.ApiClass; @@ -21,14 +22,16 @@ public class Subscription implements Serializable { public static Subscription build(FeedSubscription subscription, long unreadCount) { FeedCategory category = subscription.getCategory(); + Feed feed = subscription.getFeed(); Subscription sub = new Subscription(); sub.setId(subscription.getId()); sub.setName(subscription.getTitle()); - sub.setMessage(subscription.getFeed().getMessage()); - sub.setErrorCount(subscription.getFeed().getErrorCount()); - sub.setFeedUrl(subscription.getFeed().getUrl()); - sub.setFeedLink(subscription.getFeed().getLink()); - sub.setLastRefresh(subscription.getFeed().getLastUpdated()); + sub.setMessage(feed.getMessage()); + sub.setErrorCount(feed.getErrorCount()); + sub.setFeedUrl(feed.getUrl()); + sub.setFeedLink(feed.getLink()); + sub.setLastRefresh(feed.getLastUpdated()); + sub.setNextRefresh(feed.getDisabledUntil()); sub.setUnread(unreadCount); sub.setCategoryId(category == null ? null : String.valueOf(category .getId())); @@ -50,6 +53,9 @@ public class Subscription implements Serializable { @ApiProperty(value = "last time the feed was refreshed", required = true) private Date lastRefresh; + @ApiProperty(value = "next time the feed refresh is planned", required = true) + private Date nextRefresh; + @ApiProperty(value = "this subscription's feed url", required = true) private String feedUrl; @@ -134,4 +140,12 @@ public class Subscription implements Serializable { this.categoryId = categoryId; } + public Date getNextRefresh() { + return nextRefresh; + } + + public void setNextRefresh(Date nextRefresh) { + this.nextRefresh = nextRefresh; + } + } \ No newline at end of file diff --git a/src/main/resources/i18n/en.properties b/src/main/resources/i18n/en.properties index ad483bfe..f7d0bb54 100644 --- a/src/main/resources/i18n/en.properties +++ b/src/main/resources/i18n/en.properties @@ -61,6 +61,8 @@ details.url=URL details.name=Name details.category=Category details.last_refresh=Last refresh +details.next_refresh=Next refresh +details.queued_for_refresh=Queued for refresh details.feed_url=Feed URL details.generate_api_key_first=Generate an API key in your profile first. details.unsubscribe=Unsubscribe diff --git a/src/main/webapp/js/filters.js b/src/main/webapp/js/filters.js index bc2c4597..4ab80a69 100644 --- a/src/main/webapp/js/filters.js +++ b/src/main/webapp/js/filters.js @@ -1,7 +1,11 @@ var module = angular.module('commafeed.filters', []); module.filter('entryDate', function() { - return function(timestamp) { + return function(timestamp, defaultValue) { + if (!timestamp) { + return defaultValue; + } + var d = moment(timestamp); var now = moment(); var formatted; diff --git a/src/main/webapp/templates/feeds.feed_details.html b/src/main/webapp/templates/feeds.feed_details.html index 8082ae97..44f32104 100644 --- a/src/main/webapp/templates/feeds.feed_details.html +++ b/src/main/webapp/templates/feeds.feed_details.html @@ -33,6 +33,13 @@ {{sub.lastRefresh|entryDate}} + +
+ +
+ {{sub.nextRefresh|entryDate:'${details.queued_for_refresh}' }} +
+