Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default notification setting for conversations 'mentions only'. #2649

Open
wants to merge 1 commit into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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