Removes showIdentity and showSafetyNumber in favor of redux action
This commit is contained in:
parent
5043ac2e02
commit
135c832748
10 changed files with 14 additions and 43 deletions
|
@ -69,7 +69,7 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|||
interactionMode: 'keyboard',
|
||||
theme: ThemeType.light,
|
||||
|
||||
showSafetyNumber: action('showSafetyNumber'),
|
||||
toggleSafetyNumberModal: action('toggleSafetyNumberModal'),
|
||||
|
||||
checkForAccount: action('checkForAccount'),
|
||||
clearSelectedMessage: action('clearSelectedMessage'),
|
||||
|
|
|
@ -65,7 +65,6 @@ export type PropsData = {
|
|||
receivedAt: number;
|
||||
sentAt: number;
|
||||
|
||||
showSafetyNumber: (contactId: string) => void;
|
||||
i18n: LocalizerType;
|
||||
theme: ThemeType;
|
||||
getPreferredBadge: PreferredBadgeSelectorType;
|
||||
|
@ -101,7 +100,9 @@ export type PropsReduxActions = Pick<
|
|||
| 'doubleCheckMissingQuoteReference'
|
||||
| 'checkForAccount'
|
||||
| 'viewStory'
|
||||
>;
|
||||
> & {
|
||||
toggleSafetyNumberModal: (contactId: string) => void;
|
||||
};
|
||||
|
||||
export type ExternalProps = PropsData & PropsBackboneActions;
|
||||
export type Props = PropsData & PropsBackboneActions & PropsReduxActions;
|
||||
|
@ -162,7 +163,7 @@ export class MessageDetail extends React.Component<Props> {
|
|||
}
|
||||
|
||||
public renderContact(contact: Contact): JSX.Element {
|
||||
const { i18n, showSafetyNumber } = this.props;
|
||||
const { i18n, toggleSafetyNumberModal } = this.props;
|
||||
const errors = contact.errors || [];
|
||||
|
||||
const errorComponent = contact.isOutgoingKeyError ? (
|
||||
|
@ -170,7 +171,7 @@ export class MessageDetail extends React.Component<Props> {
|
|||
<button
|
||||
type="button"
|
||||
className="module-message-detail__contact__show-safety-number"
|
||||
onClick={() => showSafetyNumber(contact.id)}
|
||||
onClick={() => toggleSafetyNumberModal(contact.id)}
|
||||
>
|
||||
{i18n('showSafetyNumber')}
|
||||
</button>
|
||||
|
|
|
@ -21,7 +21,7 @@ const createProps = (overrideProps: Partial<Props> = {}): Props => ({
|
|||
i18n,
|
||||
contact: overrideProps.contact || ({} as ContactType),
|
||||
isGroup: boolean('isGroup', overrideProps.isGroup || false),
|
||||
showIdentity: action('showIdentity'),
|
||||
toggleSafetyNumberModal: action('toggleSafetyNumberModal'),
|
||||
});
|
||||
|
||||
export default {
|
||||
|
|
|
@ -24,7 +24,7 @@ type PropsHousekeeping = {
|
|||
};
|
||||
|
||||
export type PropsActions = {
|
||||
showIdentity: (id: string) => void;
|
||||
toggleSafetyNumberModal: (id: string) => void;
|
||||
};
|
||||
|
||||
export type Props = PropsData & PropsHousekeeping & PropsActions;
|
||||
|
@ -33,7 +33,7 @@ export function SafetyNumberNotification({
|
|||
contact,
|
||||
isGroup,
|
||||
i18n,
|
||||
showIdentity,
|
||||
toggleSafetyNumberModal,
|
||||
}: Props): JSX.Element {
|
||||
const changeKey = isGroup
|
||||
? 'safetyNumberChangedGroup'
|
||||
|
@ -62,7 +62,7 @@ export function SafetyNumberNotification({
|
|||
button={
|
||||
<Button
|
||||
onClick={() => {
|
||||
showIdentity(contact.id);
|
||||
toggleSafetyNumberModal(contact.id);
|
||||
}}
|
||||
size={ButtonSize.Small}
|
||||
variant={ButtonVariant.SystemMessage}
|
||||
|
|
|
@ -305,7 +305,7 @@ const actions = () => ({
|
|||
),
|
||||
toggleForwardMessageModal: action('toggleForwardMessageModal'),
|
||||
|
||||
showIdentity: action('showIdentity'),
|
||||
toggleSafetyNumberModal: action('toggleSafetyNumberModal'),
|
||||
|
||||
downloadNewVersion: action('downloadNewVersion'),
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ const getActions = createSelector(
|
|||
'showExpiredOutgoingTapToViewToast',
|
||||
'startConversation',
|
||||
|
||||
'showIdentity',
|
||||
'toggleSafetyNumberModal',
|
||||
|
||||
'downloadNewVersion',
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ const getDefaultProps = () => ({
|
|||
openLink: action('openLink'),
|
||||
scrollToQuotedMessage: action('scrollToQuotedMessage'),
|
||||
downloadNewVersion: action('downloadNewVersion'),
|
||||
showIdentity: action('showIdentity'),
|
||||
toggleSafetyNumberModal: action('toggleSafetyNumberModal'),
|
||||
startCallingLobby: action('startCallingLobby'),
|
||||
startConversation: action('startConversation'),
|
||||
returnToActiveCall: action('returnToActiveCall'),
|
||||
|
|
|
@ -38,8 +38,6 @@ const mapStateToProps = (
|
|||
receivedAt,
|
||||
sentAt,
|
||||
|
||||
showSafetyNumber,
|
||||
|
||||
displayTapToViewMessage,
|
||||
kickOffAttachmentDownload,
|
||||
markAttachmentAsCorrupted,
|
||||
|
@ -77,8 +75,6 @@ const mapStateToProps = (
|
|||
interactionMode: getInteractionMode(state),
|
||||
theme: getTheme(state),
|
||||
|
||||
showSafetyNumber,
|
||||
|
||||
displayTapToViewMessage,
|
||||
kickOffAttachmentDownload,
|
||||
markAttachmentAsCorrupted,
|
||||
|
|
|
@ -89,7 +89,6 @@ export type TimelinePropsType = ExternalProps &
|
|||
| 'showContactModal'
|
||||
| 'showExpiredIncomingTapToViewToast'
|
||||
| 'showExpiredOutgoingTapToViewToast'
|
||||
| 'showIdentity'
|
||||
| 'showMessageDetail'
|
||||
| 'showVisualAttachment'
|
||||
| 'startConversation'
|
||||
|
|
|
@ -21,7 +21,7 @@ import { getContactId } from '../messages/helpers';
|
|||
import { strictAssert } from '../util/assert';
|
||||
import { enqueueReactionForSend } from '../reactions/enqueueReactionForSend';
|
||||
import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions';
|
||||
import { isDirectConversation, isGroup } from '../util/whatTypeOfConversation';
|
||||
import { isGroup } from '../util/whatTypeOfConversation';
|
||||
import { findAndFormatContact } from '../util/findAndFormatContact';
|
||||
import { getPreferredBadgeSelector } from '../state/selectors/badges';
|
||||
import {
|
||||
|
@ -125,10 +125,8 @@ type MessageActionsType = {
|
|||
};
|
||||
}) => unknown;
|
||||
showContactModal: (contactId: string) => unknown;
|
||||
showSafetyNumber: (contactId: string) => unknown;
|
||||
showExpiredIncomingTapToViewToast: () => unknown;
|
||||
showExpiredOutgoingTapToViewToast: () => unknown;
|
||||
showIdentity: (conversationId: string) => unknown;
|
||||
showMessageDetail: (messageId: string) => unknown;
|
||||
showVisualAttachment: (options: {
|
||||
attachment: AttachmentType;
|
||||
|
@ -528,9 +526,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
};
|
||||
const displayTapToViewMessage = (messageId: string) =>
|
||||
this.displayTapToViewMessage(messageId);
|
||||
const showIdentity = (conversationId: string) => {
|
||||
this.showSafetyNumber(conversationId);
|
||||
};
|
||||
const openGiftBadge = (messageId: string): void => {
|
||||
const message = window.MessageController.getById(messageId);
|
||||
if (!message) {
|
||||
|
@ -546,9 +541,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
const downloadNewVersion = () => {
|
||||
openLinkInWebBrowser('https://signal.org/download');
|
||||
};
|
||||
const showSafetyNumber = (contactId: string) => {
|
||||
this.showSafetyNumber(contactId);
|
||||
};
|
||||
const showExpiredIncomingTapToViewToast = () => {
|
||||
log.info('Showing expired tap-to-view toast for an incoming message');
|
||||
showToast(ToastTapToViewExpiredIncoming);
|
||||
|
@ -574,10 +566,8 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
retryDeleteForEveryone,
|
||||
showContactDetail,
|
||||
showContactModal,
|
||||
showSafetyNumber,
|
||||
showExpiredIncomingTapToViewToast,
|
||||
showExpiredOutgoingTapToViewToast,
|
||||
showIdentity,
|
||||
showMessageDetail,
|
||||
showVisualAttachment,
|
||||
startConversation,
|
||||
|
@ -973,21 +963,6 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
view.render();
|
||||
}
|
||||
|
||||
showSafetyNumber(id?: string): void {
|
||||
let conversation: undefined | ConversationModel;
|
||||
|
||||
if (!id && isDirectConversation(this.model.attributes)) {
|
||||
conversation = this.model;
|
||||
} else {
|
||||
conversation = window.ConversationController.get(id);
|
||||
}
|
||||
if (conversation) {
|
||||
window.reduxActions.globalModals.toggleSafetyNumberModal(
|
||||
conversation.get('id')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
downloadAttachmentWrapper(
|
||||
messageId: string,
|
||||
providedAttachment?: AttachmentType
|
||||
|
|
Loading…
Reference in a new issue