mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 13:58:07 +01:00
Add reporter platform as a reported message dimension
This commit is contained in:
committed by
Jon Chambers
parent
44c61d9a58
commit
b59b8621c5
@@ -603,7 +603,8 @@ public class MessageController {
|
||||
@Auth AuthenticatedAccount auth,
|
||||
@PathParam("source") String source,
|
||||
@PathParam("messageGuid") UUID messageGuid,
|
||||
@Nullable @Valid SpamReport spamReport
|
||||
@Nullable @Valid SpamReport spamReport,
|
||||
@HeaderParam(HttpHeaders.USER_AGENT) String userAgent
|
||||
) {
|
||||
|
||||
final Optional<String> sourceNumber;
|
||||
@@ -640,7 +641,7 @@ public class MessageController {
|
||||
final Optional<byte[]> maybeSpamReportToken =
|
||||
spamReport != null ? Optional.of(spamReport.token()) : Optional.empty();
|
||||
|
||||
reportMessageManager.report(sourceNumber, sourceAci, sourcePni, messageGuid, spamReporterUuid, maybeSpamReportToken);
|
||||
reportMessageManager.report(sourceNumber, sourceAci, sourcePni, messageGuid, spamReporterUuid, maybeSpamReportToken, userAgent);
|
||||
|
||||
return Response.status(Status.ACCEPTED)
|
||||
.build();
|
||||
|
||||
@@ -16,9 +16,11 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import io.micrometer.core.instrument.Tags;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
|
||||
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
|
||||
import org.whispersystems.textsecuregcm.redis.FaultTolerantRedisCluster;
|
||||
import org.whispersystems.textsecuregcm.util.UUIDUtil;
|
||||
|
||||
@@ -67,14 +69,16 @@ public class ReportMessageManager {
|
||||
final Optional<UUID> sourcePni,
|
||||
final UUID messageGuid,
|
||||
final UUID reporterUuid,
|
||||
final Optional<byte[]> reportSpamToken) {
|
||||
final Optional<byte[]> reportSpamToken,
|
||||
final String reporterUserAgent) {
|
||||
|
||||
final boolean found = sourceAci.map(uuid -> reportMessageDynamoDb.remove(hash(messageGuid, uuid.toString())))
|
||||
.orElse(false);
|
||||
|
||||
Metrics.counter(REPORT_MESSAGE_COUNTER_NAME,
|
||||
FOUND_MESSAGE_TAG, String.valueOf(found),
|
||||
TOKEN_PRESENT_TAG, String.valueOf(reportSpamToken.isPresent()))
|
||||
Tags.of(FOUND_MESSAGE_TAG, String.valueOf(found),
|
||||
TOKEN_PRESENT_TAG, String.valueOf(reportSpamToken.isPresent()))
|
||||
.and(UserAgentTagUtil.getPlatformTag(reporterUserAgent)))
|
||||
.increment();
|
||||
|
||||
if (found) {
|
||||
|
||||
Reference in New Issue
Block a user