Minor cleanup of report spam endpoint (#1979)

This commit is contained in:
ameya-signal
2024-03-21 10:41:25 -07:00
committed by GitHub
parent e7d1eadf8e
commit 7f0f045f29
3 changed files with 5 additions and 7 deletions

View File

@@ -752,7 +752,7 @@ public class MessageController {
@ReadOnly @Auth AuthenticatedAccount auth,
@PathParam("source") String source,
@PathParam("messageGuid") UUID messageGuid,
@Nullable @Valid SpamReport spamReport,
@Nullable SpamReport spamReport,
@HeaderParam(HttpHeaders.USER_AGENT) String userAgent
) {
@@ -786,7 +786,7 @@ public class MessageController {
UUID spamReporterUuid = auth.getAccount().getUuid();
// spam report token is optional, but if provided ensure it is valid base64 and non-empty.
// spam report token is optional, but if provided ensure it is non-empty.
final Optional<byte[]> maybeSpamReportToken =
Optional.ofNullable(spamReport)
.flatMap(r -> Optional.ofNullable(r.token()))

View File

@@ -1,12 +1,9 @@
package org.whispersystems.textsecuregcm.entities;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.whispersystems.textsecuregcm.util.ByteArrayAdapter;
import javax.annotation.Nullable;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import org.whispersystems.textsecuregcm.util.ByteArrayAdapter;
public record SpamReport(@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)