Skip to content

Commit

Permalink
remove isUnidentifiedDelivery
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilb committed Jan 28, 2021
1 parent c5ad206 commit 79028eb
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 54 deletions.
17 changes: 1 addition & 16 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,25 +1071,10 @@
}
function onConfiguration(ev) {
const { configuration } = ev;
const {
readReceipts,
typingIndicators,
unidentifiedDeliveryIndicators,
linkPreviews,
} = configuration;
const { readReceipts, typingIndicators, linkPreviews } = configuration;

storage.put('read-receipt-setting', readReceipts);

if (
unidentifiedDeliveryIndicators === true ||
unidentifiedDeliveryIndicators === false
) {
storage.put(
'unidentifiedDeliveryIndicators',
unidentifiedDeliveryIndicators
);
}

if (typingIndicators === true || typingIndicators === false) {
storage.put('typing-indicators-setting', typingIndicators);
}
Expand Down
3 changes: 0 additions & 3 deletions js/models/conversations.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
if (this.isPublic) {
this.set('profileSharing', true);
}

this.unset('unidentifiedDelivery');
this.unset('unidentifiedDeliveryUnrestricted');
this.unset('hasFetchedProfile');
this.unset('tokens');

Expand Down
19 changes: 0 additions & 19 deletions js/models/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,25 +677,10 @@
: null,
};
},
isUnidentifiedDelivery(contactId, lookup) {
if (this.isIncoming()) {
return this.get('unidentifiedDeliveryReceived');
}

return Boolean(lookup[contactId]);
},
async getPropsForMessageDetail() {
const newIdentity = i18n('newIdentity');
const OUTGOING_KEY_ERROR = 'OutgoingIdentityKeyError';

const unidentifiedLookup = (
this.get('unidentifiedDeliveries') || []
).reduce((accumulator, item) => {
// eslint-disable-next-line no-param-reassign
accumulator[item] = true;
return accumulator;
}, Object.create(null));

// We include numbers we didn't successfully send to so we can display errors.
// Older messages don't have the recipients included on the message, so we fall
// back to the conversation's current recipients
Expand Down Expand Up @@ -726,9 +711,6 @@
const isOutgoingKeyError = Boolean(
_.find(errorsForContact, error => error.name === OUTGOING_KEY_ERROR)
);
const isUnidentifiedDelivery =
storage.get('unidentifiedDeliveryIndicators') &&
this.isUnidentifiedDelivery(id, unidentifiedLookup);

const contact = this.findAndFormatContact(id);
return {
Expand All @@ -738,7 +720,6 @@
status: this.getStatus(id) || this.getMessagePropStatus(),
errors: errorsForContact,
isOutgoingKeyError,
isUnidentifiedDelivery,
isPrimaryDevice: true,
profileName: contact.profileName,
};
Expand Down
5 changes: 0 additions & 5 deletions ts/components/conversation/MessageDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ interface Contact {
avatarPath?: string;
color: string;
isOutgoingKeyError: boolean;
isUnidentifiedDelivery: boolean;

errors?: Array<Error>;

Expand Down Expand Up @@ -89,9 +88,6 @@ export class MessageDetail extends React.Component<Props> {
)}
/>
) : null;
const unidentifiedDeliveryComponent = contact.isUnidentifiedDelivery ? (
<div className="module-message-detail__contact__unidentified-delivery-icon" />
) : null;

return (
<div key={contact.phoneNumber} className="module-message-detail__contact">
Expand All @@ -113,7 +109,6 @@ export class MessageDetail extends React.Component<Props> {
))}
</div>
{errorComponent}
{unidentifiedDeliveryComponent}
{statusComponent}
</div>
);
Expand Down
10 changes: 1 addition & 9 deletions ts/receiver/dataMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ export async function handleDataMessage(
sourceDevice: 1,
timestamp: _.toNumber(envelope.timestamp),
receivedAt: envelope.receivedAt,
unidentifiedDeliveryReceived: envelope.unidentifiedDeliveryReceived,
message,
};

Expand Down Expand Up @@ -414,7 +413,6 @@ interface MessageCreationData {
isPublic: boolean;
receivedAt: number;
sourceDevice: number; // always 1 isn't it?
unidentifiedDeliveryReceived: any; // ???
source: boolean;
serverId: string;
message: any;
Expand All @@ -432,7 +430,6 @@ export function initIncomingMessage(data: MessageCreationData): MessageModel {
isPublic,
receivedAt,
sourceDevice,
unidentifiedDeliveryReceived,
source,
serverId,
message,
Expand All @@ -456,7 +453,6 @@ export function initIncomingMessage(data: MessageCreationData): MessageModel {
serverTimestamp,
received_at: receivedAt || Date.now(),
conversationId: groupId ?? source,
unidentifiedDeliveryReceived, // +
type,
direction: 'incoming', // +
unread: 1, // +
Expand Down Expand Up @@ -588,11 +584,7 @@ export async function handleMessageEvent(event: MessageEvent): Promise<void> {

const isOurDevice = await UserUtils.isUs(source);

const shouldSendReceipt =
isIncoming &&
data.unidentifiedDeliveryReceived &&
!isGroupMessage &&
!isOurDevice;
const shouldSendReceipt = isIncoming && !isGroupMessage && !isOurDevice;

if (shouldSendReceipt) {
sendDeliveryReceipt(source, data.timestamp);
Expand Down
1 change: 0 additions & 1 deletion ts/receiver/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ export interface Quote {
export interface EnvelopePlus extends SignalService.Envelope {
senderIdentity: string; // Sender's pubkey after it's been decrypted (for medium groups)
receivedAt: number; // We only seem to set this for public messages?
unidentifiedDeliveryReceived: boolean;
id: string;
}
1 change: 0 additions & 1 deletion ts/state/ducks/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ const toPickFromMessageModel = [
'isIncoming',
'findAndFormatContact',
'findContact',
'isUnidentifiedDelivery',
'getStatus',
'getMessagePropStatus',
'hasErrors',
Expand Down

0 comments on commit 79028eb

Please sign in to comment.