max tags
This commit is contained in:
parent
a53db5afbf
commit
922cf5597e
@ -95,14 +95,14 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Fetch by ranking.
|
* Fetch by ranking.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param gravity the gravity
|
* @param gravity the gravity
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param asc the asc
|
* @param asc the asc
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchByRanking(String username, Instant date, FlaggedStatus flaggedStatus,
|
public Page<Entry> fetchByRanking(String username, Instant date, FlaggedStatus flaggedStatus,
|
||||||
@ -122,13 +122,13 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Fetch by date.
|
* Fetch by date.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param asc the asc
|
* @param asc the asc
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchByDate(String username, Instant date, FlaggedStatus flaggedStatus,
|
public Page<Entry> fetchByDate(String username, Instant date, FlaggedStatus flaggedStatus,
|
||||||
@ -147,14 +147,14 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Fetch by comments.
|
* Fetch by comments.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param gravity the gravity
|
* @param gravity the gravity
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param asc the asc
|
* @param asc the asc
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchByComments(String username, Instant date, FlaggedStatus flaggedStatus,
|
public Page<Entry> fetchByComments(String username, Instant date, FlaggedStatus flaggedStatus,
|
||||||
@ -175,13 +175,13 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Fetch by last comment.
|
* Fetch by last comment.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param asc the asc
|
* @param asc the asc
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchByLastComment(String username, Instant date,
|
public Page<Entry> fetchByLastComment(String username, Instant date,
|
||||||
@ -201,14 +201,14 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Fetch by user.
|
* Fetch by user.
|
||||||
*
|
*
|
||||||
* @param fromUser the from user
|
* @param fromUser the from user
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param asc the asc
|
* @param asc the asc
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchByUser(String fromUser, String username, Instant date,
|
public Page<Entry> fetchByUser(String fromUser, String username, Instant date,
|
||||||
@ -230,13 +230,13 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Creates the entry query.
|
* Creates the entry query.
|
||||||
*
|
*
|
||||||
* @param rawQuery the raw query
|
* @param rawQuery the raw query
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param additional the additional
|
* @param additional the additional
|
||||||
* @param orderBy the order by
|
* @param orderBy the order by
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
protected Query createEntryQuery(String rawQuery, String username, Instant date,
|
protected Query createEntryQuery(String rawQuery, String username, Instant date,
|
||||||
@ -284,12 +284,12 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Creates the count query.
|
* Creates the count query.
|
||||||
*
|
*
|
||||||
* @param rawQuery the raw query
|
* @param rawQuery the raw query
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param date the date
|
* @param date the date
|
||||||
* @param flaggedStatus the flagged status
|
* @param flaggedStatus the flagged status
|
||||||
* @param tag the tag
|
* @param tag the tag
|
||||||
* @param additional the additional
|
* @param additional the additional
|
||||||
* @return the query
|
* @return the query
|
||||||
*/
|
*/
|
||||||
protected Query createCountQuery(String rawQuery, String username, Instant date,
|
protected Query createCountQuery(String rawQuery, String username, Instant date,
|
||||||
@ -333,7 +333,7 @@ public class EntryManager {
|
|||||||
*
|
*
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @param asc the asc
|
* @param asc the asc
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchFlagged(int page, int size, boolean asc) {
|
public Page<Entry> fetchFlagged(int page, int size, boolean asc) {
|
||||||
@ -352,8 +352,8 @@ public class EntryManager {
|
|||||||
* Fetch by bookmarks.
|
* Fetch by bookmarks.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param page the page
|
* @param page the page
|
||||||
* @param size the size
|
* @param size the size
|
||||||
* @return the page
|
* @return the page
|
||||||
*/
|
*/
|
||||||
public Page<Entry> fetchByBookmarks(String username, int page, int size) {
|
public Page<Entry> fetchByBookmarks(String username, int page, int size) {
|
||||||
@ -371,9 +371,9 @@ public class EntryManager {
|
|||||||
* Apply metadata.
|
* Apply metadata.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param karma the karma
|
* @param karma the karma
|
||||||
* @param entry the entry
|
* @param entry the entry
|
||||||
* @param ignore the ignore
|
* @param ignore the ignore
|
||||||
*/
|
*/
|
||||||
public void applyMetadata(String username, long karma, Entry entry, List<String> ignore) {
|
public void applyMetadata(String username, long karma, Entry entry, List<String> ignore) {
|
||||||
|
|
||||||
@ -458,9 +458,9 @@ public class EntryManager {
|
|||||||
* Apply metadata.
|
* Apply metadata.
|
||||||
*
|
*
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @param karma the karma
|
* @param karma the karma
|
||||||
* @param entries the entries
|
* @param entries the entries
|
||||||
* @param ignore the ignore
|
* @param ignore the ignore
|
||||||
*/
|
*/
|
||||||
public void applyMetadata(String username, long karma, List<Entry> entries,
|
public void applyMetadata(String username, long karma, List<Entry> entries,
|
||||||
List<String> ignore) {
|
List<String> ignore) {
|
||||||
@ -497,6 +497,11 @@ public class EntryManager {
|
|||||||
*/
|
*/
|
||||||
public Entry save(Entry entry) {
|
public Entry save(Entry entry) {
|
||||||
List<String> tags = Lists.newArrayList(entry.getTags());
|
List<String> tags = Lists.newArrayList(entry.getTags());
|
||||||
|
|
||||||
|
if (tags.size() > settingsManager.getMaxTags()) {
|
||||||
|
tags = tags.subList(0, settingsManager.getMaxTags() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
entry = entryRepository.save(entry);
|
entry = entryRepository.save(entry);
|
||||||
tagManager.setForTarget(entry.getId(), tags);
|
tagManager.setForTarget(entry.getId(), tags);
|
||||||
return entry;
|
return entry;
|
||||||
@ -533,7 +538,7 @@ public class EntryManager {
|
|||||||
/**
|
/**
|
||||||
* Gets the user points.
|
* Gets the user points.
|
||||||
*
|
*
|
||||||
* @param entryId the entry id
|
* @param entryId the entry id
|
||||||
* @param username the username
|
* @param username the username
|
||||||
* @return the user points
|
* @return the user points
|
||||||
*/
|
*/
|
||||||
|
@ -24,6 +24,8 @@ public class SettingsManager {
|
|||||||
private long UNVOTE_THRESH;
|
private long UNVOTE_THRESH;
|
||||||
@Value("${bstly.board.flagThresh:3}")
|
@Value("${bstly.board.flagThresh:3}")
|
||||||
private long FLAG_THRESH;
|
private long FLAG_THRESH;
|
||||||
|
@Value("${bstly.board.maxTags:3}")
|
||||||
|
private int MAX_TAGS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the gravity.
|
* Gets the gravity.
|
||||||
@ -78,4 +80,11 @@ public class SettingsManager {
|
|||||||
public long getFlahThresh() {
|
public long getFlahThresh() {
|
||||||
return FLAG_THRESH;
|
return FLAG_THRESH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getMaxTags() {
|
||||||
|
return MAX_TAGS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ public class SettingsController extends BaseController {
|
|||||||
settings.put("pageSize", getPageSize());
|
settings.put("pageSize", getPageSize());
|
||||||
settings.put("entryDelay", getEntryDelay());
|
settings.put("entryDelay", getEntryDelay());
|
||||||
settings.put("commentDelay", getCommentDelay());
|
settings.put("commentDelay", getCommentDelay());
|
||||||
|
settings.put("maxTags", settingsManager.getMaxTags());
|
||||||
settings.put("defaultGravity", settingsManager.getGravity());
|
settings.put("defaultGravity", settingsManager.getGravity());
|
||||||
settings.put("defaultPageSize", settingsManager.getPageSize());
|
settings.put("defaultPageSize", settingsManager.getPageSize());
|
||||||
settings.put("defaultEntryDelay", settingsManager.getEntryDelay());
|
settings.put("defaultEntryDelay", settingsManager.getEntryDelay());
|
||||||
|
Loading…
Reference in New Issue
Block a user