Sync mute state
This commit is contained in:
parent
15247e1c9a
commit
6c0acd09df
16 changed files with 236 additions and 61 deletions
|
@ -34,6 +34,10 @@ import {
|
|||
} from '../util/phoneNumberDiscoverability';
|
||||
import { arePinnedConversationsEqual } from '../util/arePinnedConversationsEqual';
|
||||
import { ConversationModel } from '../models/conversations';
|
||||
import {
|
||||
getSafeLongFromTimestamp,
|
||||
getTimestampFromLong,
|
||||
} from '../util/timestampLongUtils';
|
||||
|
||||
const { updateConversation } = dataInterface;
|
||||
|
||||
|
@ -131,6 +135,9 @@ export async function toContactRecord(
|
|||
contactRecord.whitelisted = Boolean(conversation.get('profileSharing'));
|
||||
contactRecord.archived = Boolean(conversation.get('isArchived'));
|
||||
contactRecord.markedUnread = Boolean(conversation.get('markedUnread'));
|
||||
contactRecord.mutedUntilTimestamp = getSafeLongFromTimestamp(
|
||||
conversation.get('muteExpiresAt')
|
||||
);
|
||||
|
||||
applyUnknownFields(contactRecord, conversation);
|
||||
|
||||
|
@ -278,6 +285,9 @@ export async function toGroupV1Record(
|
|||
groupV1Record.whitelisted = Boolean(conversation.get('profileSharing'));
|
||||
groupV1Record.archived = Boolean(conversation.get('isArchived'));
|
||||
groupV1Record.markedUnread = Boolean(conversation.get('markedUnread'));
|
||||
groupV1Record.mutedUntilTimestamp = getSafeLongFromTimestamp(
|
||||
conversation.get('muteExpiresAt')
|
||||
);
|
||||
|
||||
applyUnknownFields(groupV1Record, conversation);
|
||||
|
||||
|
@ -297,6 +307,9 @@ export async function toGroupV2Record(
|
|||
groupV2Record.whitelisted = Boolean(conversation.get('profileSharing'));
|
||||
groupV2Record.archived = Boolean(conversation.get('isArchived'));
|
||||
groupV2Record.markedUnread = Boolean(conversation.get('markedUnread'));
|
||||
groupV2Record.mutedUntilTimestamp = getSafeLongFromTimestamp(
|
||||
conversation.get('muteExpiresAt')
|
||||
);
|
||||
|
||||
applyUnknownFields(groupV2Record, conversation);
|
||||
|
||||
|
@ -522,6 +535,13 @@ export async function mergeGroupV1Record(
|
|||
storageID,
|
||||
});
|
||||
|
||||
conversation.setMuteExpiration(
|
||||
getTimestampFromLong(groupV1Record.mutedUntilTimestamp),
|
||||
{
|
||||
viaStorageServiceSync: true,
|
||||
}
|
||||
);
|
||||
|
||||
applyMessageRequestState(groupV1Record, conversation);
|
||||
|
||||
let hasPendingChanges: boolean;
|
||||
|
@ -622,6 +642,13 @@ export async function mergeGroupV2Record(
|
|||
storageID,
|
||||
});
|
||||
|
||||
conversation.setMuteExpiration(
|
||||
getTimestampFromLong(groupV2Record.mutedUntilTimestamp),
|
||||
{
|
||||
viaStorageServiceSync: true,
|
||||
}
|
||||
);
|
||||
|
||||
applyMessageRequestState(groupV2Record, conversation);
|
||||
|
||||
addUnknownFields(groupV2Record, conversation);
|
||||
|
@ -731,6 +758,13 @@ export async function mergeContactRecord(
|
|||
storageID,
|
||||
});
|
||||
|
||||
conversation.setMuteExpiration(
|
||||
getTimestampFromLong(contactRecord.mutedUntilTimestamp),
|
||||
{
|
||||
viaStorageServiceSync: true,
|
||||
}
|
||||
);
|
||||
|
||||
const hasPendingChanges = doesRecordHavePendingChanges(
|
||||
await toContactRecord(conversation),
|
||||
contactRecord,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue