max tags
This commit is contained in:
parent
a53db5afbf
commit
922cf5597e
@ -497,6 +497,11 @@ public class EntryManager {
|
||||
*/
|
||||
public Entry save(Entry entry) {
|
||||
List<String> tags = Lists.newArrayList(entry.getTags());
|
||||
|
||||
if (tags.size() > settingsManager.getMaxTags()) {
|
||||
tags = tags.subList(0, settingsManager.getMaxTags() - 1);
|
||||
}
|
||||
|
||||
entry = entryRepository.save(entry);
|
||||
tagManager.setForTarget(entry.getId(), tags);
|
||||
return entry;
|
||||
|
@ -24,6 +24,8 @@ public class SettingsManager {
|
||||
private long UNVOTE_THRESH;
|
||||
@Value("${bstly.board.flagThresh:3}")
|
||||
private long FLAG_THRESH;
|
||||
@Value("${bstly.board.maxTags:3}")
|
||||
private int MAX_TAGS;
|
||||
|
||||
/**
|
||||
* Gets the gravity.
|
||||
@ -78,4 +80,11 @@ public class SettingsManager {
|
||||
public long getFlahThresh() {
|
||||
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("entryDelay", getEntryDelay());
|
||||
settings.put("commentDelay", getCommentDelay());
|
||||
settings.put("maxTags", settingsManager.getMaxTags());
|
||||
settings.put("defaultGravity", settingsManager.getGravity());
|
||||
settings.put("defaultPageSize", settingsManager.getPageSize());
|
||||
settings.put("defaultEntryDelay", settingsManager.getEntryDelay());
|
||||
|
Loading…
Reference in New Issue
Block a user