|
|
|
@ -196,6 +196,34 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public renderMetadataBadges() {
|
|
|
|
|
const { direction, isP2p, isPublic, isModerator } = this.props;
|
|
|
|
|
|
|
|
|
|
const badges = [isPublic && 'Public', isP2p && 'P2p', isModerator && 'Mod'];
|
|
|
|
|
|
|
|
|
|
return badges
|
|
|
|
|
.map(badgeText => {
|
|
|
|
|
if (typeof badgeText !== 'string') {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
className={classNames(
|
|
|
|
|
'module-message__metadata__badge',
|
|
|
|
|
`module-message__metadata__badge--${direction}`,
|
|
|
|
|
`module-message__metadata__badge--${badgeText.toLowerCase()}`,
|
|
|
|
|
`module-message__metadata__badge--${badgeText.toLowerCase()}--${direction}`
|
|
|
|
|
)}
|
|
|
|
|
key={badgeText}
|
|
|
|
|
>
|
|
|
|
|
• {badgeText}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.filter(i => !!i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public renderMetadata() {
|
|
|
|
|
const {
|
|
|
|
|
collapseMetadata,
|
|
|
|
@ -207,9 +235,6 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
text,
|
|
|
|
|
textPending,
|
|
|
|
|
timestamp,
|
|
|
|
|
isP2p,
|
|
|
|
|
isPublic,
|
|
|
|
|
isModerator,
|
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
|
|
if (collapseMetadata) {
|
|
|
|
@ -220,23 +245,6 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
const withImageNoCaption = Boolean(!text && isShowingImage);
|
|
|
|
|
const showError = status === 'error' && direction === 'outgoing';
|
|
|
|
|
|
|
|
|
|
const badges = [isPublic && 'Public', isP2p && 'P2p', isModerator && 'Mod'].map(badgeText => {
|
|
|
|
|
if (typeof badgeText !== 'string') return null;
|
|
|
|
|
return (
|
|
|
|
|
<span
|
|
|
|
|
className={classNames(
|
|
|
|
|
`module-message__metadata__badge`,
|
|
|
|
|
`module-message__metadata__badge--${direction}`,
|
|
|
|
|
`module-message__metadata__badge--${badgeText.toLowerCase()}`,
|
|
|
|
|
`module-message__metadata__badge--${badgeText.toLowerCase()}--${direction}`
|
|
|
|
|
)}
|
|
|
|
|
key={badgeText}
|
|
|
|
|
>
|
|
|
|
|
• {badgeText}
|
|
|
|
|
</span>
|
|
|
|
|
)
|
|
|
|
|
}).filter(i => !!i);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={classNames(
|
|
|
|
@ -268,7 +276,7 @@ export class Message extends React.PureComponent<Props, State> {
|
|
|
|
|
module="module-message__metadata__date"
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
{badges}
|
|
|
|
|
{this.renderMetadataBadges()}
|
|
|
|
|
{expirationLength && expirationTimestamp ? (
|
|
|
|
|
<ExpireTimer
|
|
|
|
|
direction={direction}
|
|
|
|
|