Skip to content

Commit

Permalink
Make default notification setting for conversations 'mentions only'.
Browse files Browse the repository at this point in the history
The current default of 'all' is very noisy, especially when restoring an
account or linking a new device, which causes all instantiated
conversations to start sending notifications.
  • Loading branch information
ianmacd committed Jan 15, 2023
1 parent 0794ede commit b289ce1
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions ts/components/leftpane/conversation-list-item/HeaderItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ const NotificationSettingIcon = (props: { isMessagesSection: boolean }) => {
/>
);
case 'mentions_only':
default:
return (
<SessionIcon
iconType="bell"
iconColor={'var(--conversation-tab-text-color)'}
iconSize="small"
/>
);
default:
return null;
}
};

Expand Down
2 changes: 1 addition & 1 deletion ts/hooks/useParamSelector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function useHasNickname(convoId?: string) {

export function useNotificationSetting(convoId?: string) {
const convoProps = useConversationPropsById(convoId);
return convoProps?.currentNotificationSetting || 'all';
return convoProps?.currentNotificationSetting || 'mentions_only';
}
export function useIsPublic(convoId?: string) {
const convoProps = useConversationPropsById(convoId);
Expand Down
2 changes: 1 addition & 1 deletion ts/models/conversationAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const fillConvoAttributesWithDefaults = (
lastMessageStatus: undefined,
lastMessage: null,

triggerNotificationsFor: 'all', // if the settings is not set in the db, this is the default
triggerNotificationsFor: 'mentions_only', // if the settings is not set in the db, this is the default

isTrustedForAttachmentDownload: false, // we don't trust a contact until we say so
isPinned: false,
Expand Down
2 changes: 1 addition & 1 deletion ts/node/database_utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export function formatRowOfConversation(row?: Record<string, any>): Conversation
}

if (!convo.triggerNotificationsFor) {
convo.triggerNotificationsFor = 'all';
convo.triggerNotificationsFor = 'mentions_only';
}

if (!convo.unreadCount) {
Expand Down
2 changes: 1 addition & 1 deletion ts/node/migration/sessionMigrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ function updateToSessionSchemaVersion24(currentVersion: number, db: BetterSqlite
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN avatarHash TEXT; -- only used for opengroup avatar.
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN nickname TEXT;
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN profileKey TEXT;
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN triggerNotificationsFor TEXT DEFAULT "all";
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN triggerNotificationsFor TEXT DEFAULT "mentions_only";
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN isTrustedForAttachmentDownload INTEGER DEFAULT "FALSE";
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN isPinned INTEGER DEFAULT "FALSE";
ALTER TABLE ${CONVERSATIONS_TABLE} ADD COLUMN isApproved INTEGER DEFAULT "FALSE";
Expand Down
5 changes: 2 additions & 3 deletions ts/state/selectors/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,11 @@ export const getCurrentNotificationSettingText = createSelector(getSelectedConve
switch (state.currentNotificationSetting) {
case 'all':
return window.i18n('notificationForConvo_all');
case 'mentions_only':
return window.i18n('notificationForConvo_mentions_only');
case 'disabled':
return window.i18n('notificationForConvo_disabled');
case 'mentions_only':
default:
return window.i18n('notificationForConvo_all');
return window.i18n('notificationForConvo_mentions_only');
}
});

Expand Down
2 changes: 1 addition & 1 deletion ts/test/session/unit/models/ConversationModels_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('fillConvoAttributesWithDefaults', () => {
it('initialize triggerNotificationsFor if not given', () => {
expect(fillConvoAttributesWithDefaults({} as ConversationAttributes)).to.have.deep.property(
'triggerNotificationsFor',
'all'
'mentions_only'
);
});

Expand Down

0 comments on commit b289ce1

Please sign in to comment.