Merge branch 'chris/report_message_aci'
This commit is contained in:
commit
2d1bf58d9e
@ -121,8 +121,8 @@ extension ConversationViewController: MessageRequestDelegate {
|
||||
return owsFailDebug("Unexpected thread type for reporting spam \(type(of: thread))")
|
||||
}
|
||||
|
||||
guard let senderPhoneNumber = contactThread.contactAddress.phoneNumber else {
|
||||
return owsFailDebug("Missing phone number for reporting spam from \(contactThread.contactAddress)")
|
||||
guard let senderUuid = contactThread.contactAddress.uuid else {
|
||||
return owsFailDebug("Missing uuid for reporting spam from \(contactThread.contactAddress)")
|
||||
}
|
||||
|
||||
// We only report a selection of the N most recent messages
|
||||
@ -157,18 +157,18 @@ extension ConversationViewController: MessageRequestDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
Logger.info("Reporting \(guidsToReport.count) message(s) from \(senderPhoneNumber) as spam.")
|
||||
Logger.info("Reporting \(guidsToReport.count) message(s) from \(senderUuid) as spam.")
|
||||
|
||||
var promises = [Promise<Void>]()
|
||||
for guid in guidsToReport {
|
||||
let request = OWSRequestFactory.reportSpam(fromPhoneNumber: senderPhoneNumber, withServerGuid: guid)
|
||||
let request = OWSRequestFactory.reportSpam(from: senderUuid, withServerGuid: guid)
|
||||
promises.append(networkManager.makePromise(request: request).asVoid())
|
||||
}
|
||||
|
||||
Promise.when(fulfilled: promises).done {
|
||||
Logger.info("Successfully reported \(guidsToReport.count) message(s) from \(senderPhoneNumber) as spam.")
|
||||
Logger.info("Successfully reported \(guidsToReport.count) message(s) from \(senderUuid) as spam.")
|
||||
}.catch { error in
|
||||
owsFailDebug("Failed to report message(s) from \(senderPhoneNumber) as spam with error: \(error)")
|
||||
owsFailDebug("Failed to report message(s) from \(senderUuid) as spam with error: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -226,7 +226,7 @@ typedef NS_ENUM(uint8_t, OWSIdentity);
|
||||
+ (TSRequest *)pushChallengeRequest;
|
||||
+ (TSRequest *)pushChallengeResponseWithToken:(NSString *)challengeToken;
|
||||
+ (TSRequest *)recaptchChallengeResponseWithToken:(NSString *)serverToken captchaToken:(NSString *)captchaToken;
|
||||
+ (TSRequest *)reportSpamFromPhoneNumber:(NSString *)phoneNumber withServerGuid:(NSString *)serverGuid;
|
||||
+ (TSRequest *)reportSpamFromUuid:(NSUUID *)senderUuid withServerGuid:(NSString *)serverGuid;
|
||||
|
||||
#pragma mark - Donations
|
||||
|
||||
|
||||
@ -894,12 +894,12 @@ NSString *const OWSRequestKey_AuthKey = @"AuthKey";
|
||||
parameters:@{ @"type" : @"recaptcha", @"token" : serverToken, @"captcha" : captchaToken }];
|
||||
}
|
||||
|
||||
+ (TSRequest *)reportSpamFromPhoneNumber:(NSString *)phoneNumber withServerGuid:(NSString *)serverGuid
|
||||
+ (TSRequest *)reportSpamFromUuid:(NSUUID *)senderUuid withServerGuid:(NSString *)serverGuid
|
||||
{
|
||||
OWSAssertDebug(phoneNumber.length > 0);
|
||||
OWSAssertDebug(senderUuid != nil);
|
||||
OWSAssertDebug(serverGuid.length > 0);
|
||||
|
||||
NSString *path = [NSString stringWithFormat:@"/v1/messages/report/%@/%@", phoneNumber, serverGuid];
|
||||
NSString *path = [NSString stringWithFormat:@"/v1/messages/report/%@/%@", senderUuid.UUIDString, serverGuid];
|
||||
return [TSRequest requestWithUrl:[NSURL URLWithString:path] method:@"POST" parameters:@{}];
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user