diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController+MessageRequest.swift b/Signal/src/ViewControllers/ConversationView/ConversationViewController+MessageRequest.swift index c27a72f0db..fe00e531a3 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController+MessageRequest.swift +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController+MessageRequest.swift @@ -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]() 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)") } } diff --git a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h index fee9bb1689..4d4c71e983 100644 --- a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h +++ b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.h @@ -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 diff --git a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m index f322dc4205..73f7bba433 100644 --- a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m +++ b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m @@ -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:@{}]; }