From a3b1b696db881b5de01656f4a1c59e874ec8d192 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Thu, 3 Mar 2022 22:35:59 -0600 Subject: [PATCH] ``: make `timestamp` prop required --- ts/components/conversation/MessageTimestamp.stories.tsx | 2 +- ts/components/conversation/MessageTimestamp.tsx | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ts/components/conversation/MessageTimestamp.stories.tsx b/ts/components/conversation/MessageTimestamp.stories.tsx index 63aa591744c7..3b43ad41c8b4 100644 --- a/ts/components/conversation/MessageTimestamp.stories.tsx +++ b/ts/components/conversation/MessageTimestamp.stories.tsx @@ -41,7 +41,7 @@ const times = (): Array<[string, number]> => [ const createProps = (overrideProps: Partial = {}): Props => ({ i18n, - timestamp: overrideProps.timestamp, + timestamp: overrideProps.timestamp || Date.now(), now: Date.now(), module: text('module', ''), withImageNoCaption: boolean('withImageNoCaption', false), diff --git a/ts/components/conversation/MessageTimestamp.tsx b/ts/components/conversation/MessageTimestamp.tsx index 930209dc56d9..219b8819b981 100644 --- a/ts/components/conversation/MessageTimestamp.tsx +++ b/ts/components/conversation/MessageTimestamp.tsx @@ -12,7 +12,7 @@ import { Time } from '../Time'; export type Props = { now: number; - timestamp?: number; + timestamp: number; module?: string; withImageNoCaption?: boolean; withSticker?: boolean; @@ -30,13 +30,9 @@ export function MessageTimestamp({ withImageNoCaption, withSticker, withTapToViewExpired, -}: Readonly): null | ReactElement { +}: Readonly): ReactElement { const moduleName = module || 'module-timestamp'; - if (timestamp === null || timestamp === undefined) { - return null; - } - return (