forked from Archives/Athou_commafeed
store and expose entry categories (#727)
This commit is contained in:
@@ -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 <a href='http://commons.apache.org/proper/commons-jexl/reference/syntax.html' target='_blank'>here</a>.",
|
||||
"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 <a href='http://commons.apache.org/proper/commons-jexl/reference/syntax.html' target='_blank'>here</a>.",
|
||||
"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?",
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
<span class="entry-author-prefix">{{ 'view.entry_author' | translate }}</span>
|
||||
<span class="entry-author-name">{{entry.author}}</span>
|
||||
</span>
|
||||
<span class="entry-categories" ng-if="entry.categories">
|
||||
<span class="entry-categories-name">({{entry.categories}})</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<FeedEntry> entries;
|
||||
|
||||
|
||||
@@ -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<Object> callable = script.callable(context);
|
||||
Future<Object> future = executor.submit(callable);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
11
src/main/resources/changelogs/db.changelog-2.2.xml
Normal file
11
src/main/resources/changelogs/db.changelog-2.2.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
|
||||
<changeSet id="add-content-categories" author="athou">
|
||||
<addColumn tableName="FEEDENTRYCONTENTS">
|
||||
<column name="categories" type="varchar(4096)" />
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
@@ -10,5 +10,6 @@
|
||||
<include file="changelogs/db.changelog-1.4.xml" />
|
||||
<include file="changelogs/db.changelog-1.5.xml" />
|
||||
<include file="changelogs/db.changelog-2.1.xml" />
|
||||
<include file="changelogs/db.changelog-2.2.xml" />
|
||||
|
||||
</databaseChangeLog>
|
||||
Reference in New Issue
Block a user