diff --git a/src/main/app/i18n/en.js b/src/main/app/i18n/en.js index d267ec54..f6fa7c8b 100644 --- a/src/main/app/i18n/en.js +++ b/src/main/app/i18n/en.js @@ -99,7 +99,7 @@ "queued_for_refresh" : "Queued for refresh", "feed_url" : "Feed URL", "filtering_expression" : "Filtering expression", - "filtering_expression_help" : "If not empty, an expression evaluating to 'true' or 'false'. If false, new entries for this feed will be marked as read automatically.\nAvailable variables are 'title', 'content', 'url' and 'author' and their content is converted to lower case to ease string comparison.\nExample: url.contains('youtube') or (author eq 'athou' and title.contains('github').\nComplete available syntax is available here.", + "filtering_expression_help" : "If not empty, an expression evaluating to 'true' or 'false'. If false, new entries for this feed will be marked as read automatically.\nAvailable variables are 'title', 'content', 'url' 'author' and 'categories' and their content is converted to lower case to ease string comparison.\nExample: url.contains('youtube') or (author eq 'athou' and title.contains('github').\nComplete available syntax is available here.", "generate_api_key_first" : "Generate an API key in your profile first.", "unsubscribe" : "Unsubscribe", "unsubscribe_confirmation" : "Are you sure you want to unsubscribe from this feed?", diff --git a/src/main/app/templates/feeds.view.html b/src/main/app/templates/feeds.view.html index 9d29c0a6..9b748444 100644 --- a/src/main/app/templates/feeds.view.html +++ b/src/main/app/templates/feeds.view.html @@ -51,6 +51,9 @@ {{ 'view.entry_author' | translate }} {{entry.author}} + + ({{entry.categories}}) + diff --git a/src/main/java/com/commafeed/backend/feed/FeedParser.java b/src/main/java/com/commafeed/backend/feed/FeedParser.java index ac49b254..4b483af4 100644 --- a/src/main/java/com/commafeed/backend/feed/FeedParser.java +++ b/src/main/java/com/commafeed/backend/feed/FeedParser.java @@ -86,6 +86,8 @@ public class FeedParser { FeedEntryContent content = new FeedEntryContent(); content.setContent(getContent(item)); + content.setCategories(FeedUtils.truncate( + item.getCategories().stream().map(c -> c.getName()).collect(Collectors.joining(", ")), 4096)); content.setTitle(getTitle(item)); content.setAuthor(StringUtils.trimToNull(item.getAuthor())); SyndEnclosure enclosure = Iterables.getFirst(item.getEnclosures(), null); diff --git a/src/main/java/com/commafeed/backend/model/FeedEntryContent.java b/src/main/java/com/commafeed/backend/model/FeedEntryContent.java index fe34967b..7b036d20 100644 --- a/src/main/java/com/commafeed/backend/model/FeedEntryContent.java +++ b/src/main/java/com/commafeed/backend/model/FeedEntryContent.java @@ -43,6 +43,9 @@ public class FeedEntryContent extends AbstractModel { @Column(length = 255) private String enclosureType; + @Column(length = 4096) + private String categories; + @OneToMany(mappedBy = "content") private Set entries; diff --git a/src/main/java/com/commafeed/backend/service/FeedEntryFilteringService.java b/src/main/java/com/commafeed/backend/service/FeedEntryFilteringService.java index bfb7d4ff..c576ff45 100644 --- a/src/main/java/com/commafeed/backend/service/FeedEntryFilteringService.java +++ b/src/main/java/com/commafeed/backend/service/FeedEntryFilteringService.java @@ -89,6 +89,7 @@ public class FeedEntryFilteringService { context.set("content", entry.getContent().getContent() == null ? "" : Jsoup.parse(entry.getContent().getContent()).text() .toLowerCase()); context.set("url", entry.getUrl() == null ? "" : entry.getUrl().toLowerCase()); + context.set("categories", entry.getContent().getCategories() == null ? "" : entry.getContent().getCategories().toLowerCase()); Callable callable = script.callable(context); Future future = executor.submit(callable); diff --git a/src/main/java/com/commafeed/frontend/model/Entry.java b/src/main/java/com/commafeed/frontend/model/Entry.java index abdd9530..b709a278 100644 --- a/src/main/java/com/commafeed/frontend/model/Entry.java +++ b/src/main/java/com/commafeed/frontend/model/Entry.java @@ -56,6 +56,7 @@ public class Entry implements Serializable { entry.setAuthor(content.getAuthor()); entry.setEnclosureUrl(content.getEnclosureUrl()); entry.setEnclosureType(content.getEnclosureType()); + entry.setCategories(content.getCategories()); } return entry; @@ -95,6 +96,9 @@ public class Entry implements Serializable { @ApiModelProperty("entry content") private String content; + @ApiModelProperty("comma-separated list of categories") + private String categories; + @ApiModelProperty("wether entry content and title are rtl") private boolean rtl; diff --git a/src/main/resources/changelogs/db.changelog-2.2.xml b/src/main/resources/changelogs/db.changelog-2.2.xml new file mode 100644 index 00000000..1af324a6 --- /dev/null +++ b/src/main/resources/changelogs/db.changelog-2.2.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/src/main/resources/migrations.xml b/src/main/resources/migrations.xml index 8da3a73d..05b0e223 100644 --- a/src/main/resources/migrations.xml +++ b/src/main/resources/migrations.xml @@ -10,5 +10,6 @@ + \ No newline at end of file