diff --git a/ts/components/CompositionArea.stories.tsx b/ts/components/CompositionArea.stories.tsx
index 4eee071d5..cdf5f25c8 100644
--- a/ts/components/CompositionArea.stories.tsx
+++ b/ts/components/CompositionArea.stories.tsx
@@ -36,6 +36,7 @@ export default {
areWePendingApproval: { control: { type: 'boolean' } },
},
args: {
+ acceptedMessageRequest: true,
addAttachment: action('addAttachment'),
conversationId: '123',
convertDraftBodyRangesIntoHydrated: () => undefined,
@@ -116,8 +117,7 @@ export default {
groupAdmins: [],
cancelJoinRequest: action('cancelJoinRequest'),
showConversation: action('showConversation'),
- // SMS-only
- isSMSOnly: false,
+ isSmsOnlyOrUnregistered: false,
isFetchingUUID: false,
renderSmartCompositionRecording: _ =>
RECORDING
,
renderSmartCompositionRecordingDraft: _ => RECORDING DRAFT
,
@@ -158,17 +158,26 @@ export function StickerButton(args: Props): JSX.Element {
export function MessageRequest(args: Props): JSX.Element {
const theme = useContext(StorybookThemeContext);
- return ;
+ return (
+
+ );
}
export function SmsOnlyFetchingUuid(args: Props): JSX.Element {
const theme = useContext(StorybookThemeContext);
- return ;
+ return (
+
+ );
}
export function SmsOnly(args: Props): JSX.Element {
const theme = useContext(StorybookThemeContext);
- return ;
+ return ;
}
export function Attachments(args: Props): JSX.Element {
diff --git a/ts/components/CompositionArea.tsx b/ts/components/CompositionArea.tsx
index c71c3985d..443aedc6a 100644
--- a/ts/components/CompositionArea.tsx
+++ b/ts/components/CompositionArea.tsx
@@ -118,7 +118,7 @@ export type OwnProps = Readonly<{
recordingState: RecordingState;
messageCompositionId: string;
shouldHidePopovers: boolean | null;
- isSMSOnly: boolean | null;
+ isSmsOnlyOrUnregistered: boolean | null;
left: boolean | null;
linkPreviewLoading: boolean;
linkPreviewResult: LinkPreviewType | null;
@@ -331,7 +331,7 @@ export const CompositionArea = memo(function CompositionArea({
cancelJoinRequest,
showConversation,
// SMS-only contacts
- isSMSOnly,
+ isSmsOnlyOrUnregistered,
isFetchingUUID,
renderSmartCompositionRecording,
renderSmartCompositionRecordingDraft,
@@ -800,7 +800,7 @@ export const CompositionArea = memo(function CompositionArea({
);
}
- if (conversationType === 'direct' && isSMSOnly) {
+ if (conversationType === 'direct' && isSmsOnlyOrUnregistered) {
return (
;
theme: ThemeType;
@@ -159,7 +159,7 @@ export const ConversationHeader = memo(function ConversationHeader({
isMissingMandatoryProfileSharing,
isSelectMode,
isSignalConversation,
- isSMSOnly,
+ isSmsOnlyOrUnregistered,
localDeleteWarningShown,
onConversationAccept,
onConversationArchive,
@@ -295,7 +295,7 @@ export const ConversationHeader = memo(function ConversationHeader({
onViewUserStories={onViewUserStories}
onViewConversationDetails={onViewConversationDetails}
/>
- {!isSMSOnly && !isSignalConversation && (
+ {!isSmsOnlyOrUnregistered && !isSignalConversation && (
{
});
['direct', 'private'].forEach(type => {
- it('returns false if passed an undefined discoveredUnregisteredAt', () => {
- assert.isFalse(
- isConversationSMSOnly({ type, discoveredUnregisteredAt: undefined })
- );
- });
-
- it('returns true if passed a very old discoveredUnregisteredAt', () => {
- assert.isTrue(
- isConversationSMSOnly({
- type,
- e164: 'e164',
- serviceId,
- discoveredUnregisteredAt: 1,
- })
- );
- });
-
- it(`returns true if passed a time fewer than 6 hours ago and is ${type}`, () => {
- assert.isTrue(
- isConversationSMSOnly({
- type,
- e164: 'e164',
- serviceId,
- discoveredUnregisteredAt: Date.now(),
- })
- );
-
- const fiveHours = 1000 * 60 * 60 * 5;
- assert.isTrue(
- isConversationSMSOnly({
- type,
- e164: 'e164',
- serviceId,
- discoveredUnregisteredAt: Date.now() - fiveHours,
- })
- );
- });
-
- it(`returns true conversation is ${type} and has no uuid`, () => {
- assert.isTrue(isConversationSMSOnly({ type, e164: 'e164' }));
+ it(`requires an e164 but no serviceId, type ${type}`, () => {
assert.isFalse(isConversationSMSOnly({ type }));
+ assert.isFalse(isConversationSMSOnly({ type, serviceId }));
+ assert.isFalse(isConversationSMSOnly({ type, e164: 'e164', serviceId }));
+ assert.isTrue(isConversationSMSOnly({ type, e164: 'e164' }));
});
});
diff --git a/ts/util/isConversationSMSOnly.ts b/ts/util/isConversationSMSOnly.ts
index 1221ed330..2362f77ce 100644
--- a/ts/util/isConversationSMSOnly.ts
+++ b/ts/util/isConversationSMSOnly.ts
@@ -19,9 +19,13 @@ export function isConversationSMSOnly(
return false;
}
- if (e164 && !serviceId) {
- return true;
+ if (serviceId) {
+ return false;
}
- return conversation.discoveredUnregisteredAt !== undefined;
+ if (!e164) {
+ return false;
+ }
+
+ return true;
}