Sync two more settings: includeMutedChatsInBadge and reactionNotifications

This commit is contained in:
trevor-signal
2026-08-28 12:40:01 -04:00
committed by GitHub
parent d3c13ce644
commit e226d149b3
7 changed files with 55 additions and 1 deletions
+2
View File
@@ -138,6 +138,8 @@ message AccountData {
bool allowSealedSenderFromAnyone = 30;
bool allowAutomaticKeyVerification = 31;
bool hasSeenAdminDeleteEducationDialog = 32;
optional bool includeMutedChatsInBadge = 34; // If unset, consider this disabled
optional bool reactionNotifications = 35; // If unset, consider this enabled
optional bool notifyForCallsIfMuted = 36; // If unset, consider this disabled
optional bool notifyForMentionsIfMuted = 37; // If unset, consider this enabled
optional bool notifyForRepliesIfMuted = 38; // If unset, consider this enabled
+2
View File
@@ -312,6 +312,8 @@ message AccountRecord {
optional bool releaseNotesChatBlocked = 50;
optional bool releaseNotesChatMarkedUnread = 51;
optional uint64 releaseNotesChatBlockedAt = 52; // only set if known (>0)
OptionalBool includeMutedChatsInBadge = 54; // If unset, consider this off
OptionalBool reactionNotifications = 55; // If unset, consider this on
OptionalBool notifyForCallsIfMuted = 56; // If unset, consider this off
OptionalBool notifyForMentionsIfMuted = 57; // If unset, consider this on
OptionalBool notifyForRepliesIfMuted = 58; // If unset, consider this on
+3
View File
@@ -1101,6 +1101,9 @@ export class BackupExportStream extends Readable {
itemStorage.get('hasSeenGroupStoryEducationSheet') ?? null,
hasSeenAdminDeleteEducationDialog:
itemStorage.get('hasSeenAdminDeleteEducationDialog') ?? null,
includeMutedChatsInBadge:
itemStorage.get('badge-count-muted-conversations') ?? null,
reactionNotifications: itemStorage.get('reaction-notification') ?? null,
phoneNumberSharingMode,
// Note that this should be called before `toDefaultChatStyle` because
// it builds `customColorIdByUuid`
+11
View File
@@ -939,6 +939,17 @@ export class BackupImportStream extends Writable {
'hasSeenAdminDeleteEducationDialog',
accountSettings?.hasSeenAdminDeleteEducationDialog === true
);
await itemStorage.put(
'badge-count-muted-conversations',
// unset should be treated as false
accountSettings?.includeMutedChatsInBadge === true
);
await itemStorage.put(
'reaction-notification',
// unset should be treated as true
accountSettings?.reactionNotifications !== false
);
await itemStorage.put(
'preferredReactionEmoji',
accountSettings?.preferredReactionEmoji?.map(emoji => {
+26
View File
@@ -661,6 +661,13 @@ export function toAccountRecord({
hasSeenAdminDeleteEducationDialog:
itemStorage.get('hasSeenAdminDeleteEducationDialog') ?? null,
includeMutedChatsInBadge: toOptionalBool(
itemStorage.get('badge-count-muted-conversations')
),
reactionNotifications: toOptionalBool(
itemStorage.get('reaction-notification')
),
avatarColor: ourConversation.get('colorFromPrimary') ?? null,
automaticKeyVerificationDisabled:
itemStorage.get('hasKeyTransparencyDisabled') === true,
@@ -1684,6 +1691,8 @@ export async function mergeAccountRecord(
hasSeenAdminDeleteEducationDialog,
hasSetMyStoriesPrivacy,
hasViewedOnboardingStory,
includeMutedChatsInBadge,
reactionNotifications,
storiesDisabled,
storyViewReceiptsEnabled,
username,
@@ -1990,6 +1999,23 @@ export async function mergeAccountRecord(
'hasSeenAdminDeleteEducationDialog',
hasSeenAdminDeleteEducationDialog ?? false
);
{
// default to false (exclude muted chats)
const countMutedConversations =
fromOptionalBool(includeMutedChatsInBadge) ?? false;
const previous = itemStorage.get('badge-count-muted-conversations', false);
await itemStorage.put(
'badge-count-muted-conversations',
countMutedConversations
);
if (previous !== countMutedConversations) {
window.Whisper.events.emit('updateUnreadCount');
}
}
await itemStorage.put(
'reaction-notification',
fromOptionalBool(reactionNotifications) ?? true
);
{
await itemStorage.put(
'hasKeyTransparencyDisabled',
+9 -1
View File
@@ -767,6 +767,9 @@ export function SmartPreferences(): JSX.Element | null {
NOTIFICATION_SETTING_DEFAULTS['badge-count-muted-conversations'],
() => {
window.Whisper.events.emit('updateUnreadCount');
const account =
window.ConversationController.getOurConversationOrThrow();
account.captureChange('badge-count-muted-conversations');
}
);
const [hasHideMenuBar, onHideMenuBarChange] = createItemsAccess(
@@ -789,7 +792,12 @@ export function SmartPreferences(): JSX.Element | null {
const [hasReactionNotifications, onReactionNotificationsChange] =
createItemsAccess(
'reaction-notification',
NOTIFICATION_SETTING_DEFAULTS['reaction-notification']
NOTIFICATION_SETTING_DEFAULTS['reaction-notification'],
() => {
const account =
window.ConversationController.getOurConversationOrThrow();
account.captureChange('reaction-notification');
}
);
const [notificationContent, onNotificationContentChange] = createItemsAccess(
+2
View File
@@ -135,6 +135,8 @@ function* createRecords({
hasSeenGroupStoryEducationSheet: true,
hasCompletedUsernameOnboarding: true,
hasSeenAdminDeleteEducationDialog: false,
includeMutedChatsInBadge: true,
reactionNotifications: true,
phoneNumberSharingMode:
Backups.AccountData.PhoneNumberSharingMode.EVERYBODY,
defaultChatStyle: {