Adjust routing for stories.

This commit is contained in:
erik-signal
2022-10-05 12:20:42 -04:00
committed by GitHub
parent 966c3a8f47
commit 544e4fb89a
3 changed files with 4 additions and 6 deletions

View File

@@ -165,11 +165,10 @@ public class MessageController {
@HeaderParam("User-Agent") String userAgent,
@HeaderParam("X-Forwarded-For") String forwardedFor,
@PathParam("destination") UUID destinationUuid,
@QueryParam("story") boolean isStory,
@NotNull @Valid IncomingMessageList messages)
throws RateLimitExceededException {
boolean isStory = messages.story();
if (source.isEmpty() && accessKey.isEmpty() && !isStory) {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}

View File

@@ -11,15 +11,14 @@ import javax.validation.Valid;
import javax.validation.constraints.NotNull;
public record IncomingMessageList(@NotNull @Valid List<@NotNull IncomingMessage> messages,
boolean online, boolean urgent, boolean story, long timestamp) {
boolean online, boolean urgent, long timestamp) {
@JsonCreator
public IncomingMessageList(@JsonProperty("messages") @NotNull @Valid List<@NotNull IncomingMessage> messages,
@JsonProperty("online") boolean online,
@JsonProperty("urgent") Boolean urgent,
@JsonProperty("story") Boolean story,
@JsonProperty("timestamp") long timestamp) {
this(messages, online, urgent == null || urgent, story != null && story, timestamp);
this(messages, online, urgent == null || urgent, timestamp);
}
}