Spam Reporting UI changes

This commit is contained in:
Jamie Kyle 2024-03-12 09:29:31 -07:00 committed by GitHub
parent e031d136a1
commit 8387f938eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 2711 additions and 807 deletions

View file

@ -45,12 +45,15 @@ import {
isTapToView,
isUnsupportedMessage,
isConversationMerge,
isMessageRequestResponse,
} from '../state/selectors/message';
import {
getContact,
messageHasPaymentEvent,
getPaymentEventNotificationText,
} from '../messages/helpers';
import { MessageRequestResponseEvent } from '../types/MessageRequestResponseEvent';
import { missingCaseError } from './missingCaseError';
function getNameForNumber(e164: string): string {
const conversation = window.ConversationController.get(e164);
@ -177,6 +180,34 @@ export function getNotificationDataForMessage(
};
}
if (isMessageRequestResponse(attributes)) {
const { messageRequestResponseEvent: event } = attributes;
strictAssert(
event,
'getNotificationData: isMessageRequestResponse true, but no messageRequestResponseEvent!'
);
let text: string;
if (event === MessageRequestResponseEvent.ACCEPT) {
text = window.i18n(
'icu:MessageRequestResponseNotification__Message--Accepted'
);
} else if (event === MessageRequestResponseEvent.SPAM) {
text = window.i18n(
'icu:MessageRequestResponseNotification__Message--Reported'
);
} else if (event === MessageRequestResponseEvent.BLOCK) {
text = window.i18n(
'icu:MessageRequestResponseNotification__Message--Blocked'
);
} else {
throw missingCaseError(event);
}
return {
text,
};
}
const { attachments = [] } = attributes;
if (isTapToView(attributes)) {