This commit is contained in:
_Bastler 2021-12-01 19:25:33 +01:00
parent a53db5afbf
commit 922cf5597e
3 changed files with 69 additions and 54 deletions

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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());