disallow future fetching
This commit is contained in:
parent
fe47739cb8
commit
50c2776f19
@ -72,6 +72,14 @@ public class CommentController extends BaseController {
|
||||
@RequestParam("date") Optional<Instant> dateParameter,
|
||||
@RequestParam("desc") Optional<Boolean> descParameter,
|
||||
@RequestParam("ignore") Optional<List<String>> ignoreParameter) {
|
||||
|
||||
if (sizeParameter.isPresent() && sizeParameter.get() > 100) {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
Page<Comment> comments = commentManager.fetchByDate(getCurrentUsername(), target,
|
||||
parent.orElse(null), dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
|
||||
sizeParameter.orElse(settingsManager.getPageSize()), descParameter.orElse(false));
|
||||
@ -102,6 +110,15 @@ public class CommentController extends BaseController {
|
||||
@RequestParam("date") Optional<Instant> dateParameter,
|
||||
@RequestParam("asc") Optional<Boolean> ascParameter,
|
||||
@RequestParam("ignore") Optional<List<String>> ignoreParameter) {
|
||||
|
||||
if (sizeParameter.isPresent() && sizeParameter.get() > 100) {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
|
||||
Page<Comment> comments = commentManager.fetchByUsername(username, parent.orElse(null),
|
||||
dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
|
||||
sizeParameter.orElse(settingsManager.getPageSize()), ascParameter.orElse(false));
|
||||
|
@ -82,6 +82,14 @@ public class EntryController extends BaseController {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
|
||||
if (gravityParameter.isPresent() && gravityParameter.get() > 2) {
|
||||
gravityParameter = Optional.of(2.0);
|
||||
}
|
||||
|
||||
Page<RankedEntry> entries = entryManager.fetchByRanking(dateParameter.orElse(Instant.now()),
|
||||
gravityParameter.orElse(getGravity()), pageParameter.orElse(0),
|
||||
sizeParameter.orElse(settingsManager.getPageSize()));
|
||||
@ -119,6 +127,10 @@ public class EntryController extends BaseController {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
|
||||
Page<Entry> entries = entryManager.fetchByDate(dateParameter.orElse(Instant.now()),
|
||||
pageParameter.orElse(0), sizeParameter.orElse(settingsManager.getPageSize()));
|
||||
List<String> ignore = ignoreParameter.orElse(Lists.newArrayList());
|
||||
@ -149,6 +161,10 @@ public class EntryController extends BaseController {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
|
||||
Page<RankedEntry> entries = entryManager.fetchByComments(
|
||||
dateParameter.orElse(Instant.now()), gravityParameter.orElse(getGravity()),
|
||||
pageParameter.orElse(0), sizeParameter.orElse(settingsManager.getPageSize()));
|
||||
@ -184,6 +200,10 @@ public class EntryController extends BaseController {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
|
||||
Page<Entry> entries = entryManager.fetchByLastComment(dateParameter.orElse(Instant.now()),
|
||||
pageParameter.orElse(0), sizeParameter.orElse(settingsManager.getPageSize()));
|
||||
|
||||
@ -217,6 +237,10 @@ public class EntryController extends BaseController {
|
||||
sizeParameter = Optional.of(100);
|
||||
}
|
||||
|
||||
if (dateParameter.isPresent() && dateParameter.get().isAfter(Instant.now())) {
|
||||
dateParameter = Optional.of(Instant.now());
|
||||
}
|
||||
|
||||
Page<Entry> entries = entryManager.fetchByUser(username,
|
||||
dateParameter.orElse(Instant.now()), pageParameter.orElse(0),
|
||||
sizeParameter.orElse(settingsManager.getPageSize()), ascParameter.orElse(false));
|
||||
|
Loading…
Reference in New Issue
Block a user