remove i18n requirement in props for message

pull/1387/head
Audric Ackermann 5 years ago
parent 0b9cb58ae6
commit f117a083c1
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -80,7 +80,6 @@ export interface Props {
onSendMessage?: () => void; onSendMessage?: () => void;
onClick?: () => void; onClick?: () => void;
}; };
i18n: LocalizerType;
authorName?: string; authorName?: string;
authorProfileName?: string; authorProfileName?: string;
/** Note: this should be formatted for display */ /** Note: this should be formatted for display */
@ -256,7 +255,6 @@ export class Message extends React.PureComponent<Props, State> {
direction, direction,
expirationLength, expirationLength,
expirationTimestamp, expirationTimestamp,
i18n,
status, status,
text, text,
textPending, textPending,
@ -299,11 +297,11 @@ export class Message extends React.PureComponent<Props, State> {
: null : null
)} )}
> >
{i18n('sendFailed')} {window.i18n('sendFailed')}
</span> </span>
) : ( ) : (
<Timestamp <Timestamp
i18n={i18n} i18n={window.i18n}
timestamp={serverTimestamp || timestamp} timestamp={serverTimestamp || timestamp}
extended={true} extended={true}
direction={direction} direction={direction}
@ -355,7 +353,6 @@ export class Message extends React.PureComponent<Props, State> {
collapseMetadata, collapseMetadata,
conversationType, conversationType,
direction, direction,
i18n,
quote, quote,
onClickAttachment, onClickAttachment,
} = this.props; } = this.props;
@ -396,7 +393,7 @@ export class Message extends React.PureComponent<Props, State> {
withContentAbove={withContentAbove} withContentAbove={withContentAbove}
withContentBelow={withContentBelow} withContentBelow={withContentBelow}
bottomOverlay={!collapseMetadata} bottomOverlay={!collapseMetadata}
i18n={i18n} i18n={window.i18n}
onError={this.handleImageErrorBound} onError={this.handleImageErrorBound}
onClickAttachment={onClickAttachment} onClickAttachment={onClickAttachment}
/> />
@ -520,7 +517,6 @@ export class Message extends React.PureComponent<Props, State> {
attachments, attachments,
conversationType, conversationType,
direction, direction,
i18n,
onClickLinkPreview, onClickLinkPreview,
previews, previews,
quote, quote,
@ -569,7 +565,7 @@ export class Message extends React.PureComponent<Props, State> {
withContentAbove={withContentAbove} withContentAbove={withContentAbove}
withContentBelow={true} withContentBelow={true}
onError={this.handleImageErrorBound} onError={this.handleImageErrorBound}
i18n={i18n} i18n={window.i18n}
/> />
) : null} ) : null}
<div <div
@ -585,13 +581,13 @@ export class Message extends React.PureComponent<Props, State> {
<Image <Image
smallCurveTopLeft={!withContentAbove} smallCurveTopLeft={!withContentAbove}
softCorners={true} softCorners={true}
alt={i18n('previewThumbnail', [first.domain])} alt={window.i18n('previewThumbnail', [first.domain])}
height={72} height={72}
width={72} width={72}
url={first.image.url} url={first.image.url}
attachment={first.image} attachment={first.image}
onError={this.handleImageErrorBound} onError={this.handleImageErrorBound}
i18n={i18n} i18n={window.i18n}
/> />
</div> </div>
) : null} ) : null}
@ -641,7 +637,7 @@ export class Message extends React.PureComponent<Props, State> {
return ( return (
<Quote <Quote
i18n={i18n} i18n={window.i18n}
onClick={quote.onClick} onClick={quote.onClick}
text={quote.text} text={quote.text}
attachment={quote.attachment} attachment={quote.attachment}
@ -665,7 +661,6 @@ export class Message extends React.PureComponent<Props, State> {
contact, contact,
conversationType, conversationType,
direction, direction,
i18n,
text, text,
} = this.props; } = this.props;
if (!contact) { if (!contact) {
@ -682,7 +677,7 @@ export class Message extends React.PureComponent<Props, State> {
contact={contact} contact={contact}
hasSignalAccount={contact.hasSignalAccount} hasSignalAccount={contact.hasSignalAccount}
isIncoming={direction === 'incoming'} isIncoming={direction === 'incoming'}
i18n={i18n} i18n={window.i18n}
onClick={contact.onClick} onClick={contact.onClick}
withContentAbove={withContentAbove} withContentAbove={withContentAbove}
withContentBelow={withContentBelow} withContentBelow={withContentBelow}
@ -700,7 +695,6 @@ export class Message extends React.PureComponent<Props, State> {
senderIsModerator, senderIsModerator,
conversationType, conversationType,
direction, direction,
i18n,
onShowUserDetails, onShowUserDetails,
} = this.props; } = this.props;
@ -737,7 +731,6 @@ export class Message extends React.PureComponent<Props, State> {
const { const {
text, text,
textPending, textPending,
i18n,
direction, direction,
status, status,
isRss, isRss,
@ -747,7 +740,7 @@ export class Message extends React.PureComponent<Props, State> {
const contents = const contents =
direction === 'incoming' && status === 'error' direction === 'incoming' && status === 'error'
? i18n('incomingError') ? window.i18n('incomingError')
: text; : text;
if (!contents) { if (!contents) {
@ -768,7 +761,7 @@ export class Message extends React.PureComponent<Props, State> {
<MessageBody <MessageBody
text={contents || ''} text={contents || ''}
isRss={isRss} isRss={isRss}
i18n={i18n} i18n={window.i18n}
textPending={textPending} textPending={textPending}
isGroup={conversationType === 'group'} isGroup={conversationType === 'group'}
convoId={convoId} convoId={convoId}
@ -818,7 +811,6 @@ export class Message extends React.PureComponent<Props, State> {
onRetrySend, onRetrySend,
onShowDetail, onShowDetail,
isPublic, isPublic,
i18n,
isModerator, isModerator,
onBanUser, onBanUser,
} = this.props; } = this.props;
@ -852,7 +844,7 @@ export class Message extends React.PureComponent<Props, State> {
}; };
const isServerDeletable = !!this.props.isPublic; const isServerDeletable = !!this.props.isPublic;
const deleteMessageCtxText = i18n( const deleteMessageCtxText = window.i18n(
isServerDeletable ? 'deleteForEveryone' : 'delete' isServerDeletable ? 'deleteForEveryone' : 'delete'
); );
@ -874,18 +866,20 @@ export class Message extends React.PureComponent<Props, State> {
} }
}} }}
> >
{i18n('downloadAttachment')} {window.i18n('downloadAttachment')}
</MenuItem> </MenuItem>
) : null} ) : null}
<MenuItem onClick={wrap(onCopyText)}>{i18n('copyMessage')}</MenuItem> <MenuItem onClick={wrap(onCopyText)}>
{window.i18n('copyMessage')}
</MenuItem>
<MenuItem <MenuItem
attributes={{ attributes={{
className: 'module-message__context__reply', className: 'module-message__context__reply',
}} }}
onClick={this.onReplyPrivate} onClick={this.onReplyPrivate}
> >
{i18n('replyToMessage')} {window.i18n('replyToMessage')}
</MenuItem> </MenuItem>
<MenuItem <MenuItem
attributes={{ attributes={{
@ -893,7 +887,7 @@ export class Message extends React.PureComponent<Props, State> {
}} }}
onClick={wrap(onShowDetail)} onClick={wrap(onShowDetail)}
> >
{i18n('moreInformation')} {window.i18n('moreInformation')}
</MenuItem> </MenuItem>
{showRetry ? ( {showRetry ? (
<MenuItem <MenuItem
@ -902,7 +896,7 @@ export class Message extends React.PureComponent<Props, State> {
}} }}
onClick={wrap(onRetrySend)} onClick={wrap(onRetrySend)}
> >
{i18n('resend')} {window.i18n('resend')}
</MenuItem> </MenuItem>
) : null} ) : null}
{isDeletable ? ( {isDeletable ? (
@ -916,7 +910,9 @@ export class Message extends React.PureComponent<Props, State> {
</MenuItem> </MenuItem>
) : null} ) : null}
{isModerator && isPublic ? ( {isModerator && isPublic ? (
<MenuItem onClick={wrap(onBanUser)}>{i18n('banUser')}</MenuItem> <MenuItem onClick={wrap(onBanUser)}>
{window.i18n('banUser')}
</MenuItem>
) : null} ) : null}
</ContextMenu> </ContextMenu>
); );
@ -1123,7 +1119,6 @@ export class Message extends React.PureComponent<Props, State> {
authorProfileName, authorProfileName,
conversationType, conversationType,
direction, direction,
i18n,
isPublic, isPublic,
} = this.props; } = this.props;
@ -1146,7 +1141,7 @@ export class Message extends React.PureComponent<Props, State> {
name={authorName} name={authorName}
profileName={authorProfileName} profileName={authorProfileName}
module="module-message__author" module="module-message__author"
i18n={i18n} i18n={window.i18n}
boldProfileName={true} boldProfileName={true}
shouldShowPubkey={Boolean(isPublic)} shouldShowPubkey={Boolean(isPublic)}
/> />

@ -143,7 +143,7 @@ export class MessageDetail extends React.Component<Props> {
return ( return (
<div className="module-message-detail"> <div className="module-message-detail">
<div className="module-message-detail__message-container"> <div className="module-message-detail__message-container">
<Message i18n={i18n} {...message} /> <Message {...message} />
</div> </div>
<table className="module-message-detail__info"> <table className="module-message-detail__info">
<tbody> <tbody>

Loading…
Cancel
Save