Skip to content
Merged
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
21 changes: 21 additions & 0 deletions apps/meteor/app/models/server/models/Subscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,27 @@ export class Subscriptions extends Base {
return this.update(query, update);
}

updateHideMentionStatusById(_id, hideMentionStatus) {
const query = {
_id,
};

const update =
hideMentionStatus === true
? {
$set: {
hideMentionStatus,
},
}
: {
$unset: {
hideMentionStatus: 1,
},
};

return this.update(query, update);
}

updateMuteGroupMentions(_id, muteGroupMentions) {
const query = {
_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ Meteor.methods({
hideUnreadStatus: {
updateMethod: (subscription, value) => Subscriptions.updateHideUnreadStatusById(subscription._id, value === '1'),
},
hideMentionStatus: {
updateMethod: (subscription, value) => Subscriptions.updateHideMentionStatusById(subscription._id, value === '1'),
},
muteGroupMentions: {
updateMethod: (subscription, value) => Subscriptions.updateMuteGroupMentions(subscription._id, value === '1'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function SideBarItemTemplateWithData({
const {
lastMessage,
hideUnreadStatus,
hideMentionStatus,
unread = 0,
alert,
userMentions,
Expand Down Expand Up @@ -70,8 +71,9 @@ function SideBarItemTemplateWithData({
const variant =
((userMentions || tunreadUser.length) && 'danger') || (threadUnread && 'primary') || (groupMentions && 'warning') || 'ghost';
const isUnread = unread > 0 || threadUnread;
const showBadge = !hideUnreadStatus || (!hideMentionStatus && userMentions);
const badges =
!hideUnreadStatus && isUnread ? (
showBadge && isUnread ? (
<Badge style={{ flexShrink: 0 }} variant={variant}>
{unread + tunread?.length}
</Badge>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ const NotificationPreferences = ({
onChange={formHandlers?.handleShowCounter}
defaultChecked={formValues?.showCounter}
/>
{!formValues?.showCounter && (
<NotificationToogle
label={t('Show_mentions')}
description={t('Display_mentions_counter')}
onChange={formHandlers?.handleShowMentions}
defaultChecked={formValues?.showMentions}
/>
)}
<FieldGroup>
<NotificationByDevice device={t('Desktop')} icon={'computer'}>
<Preferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Default.args = {
turnOn: true,
muteGroupMentions: false,
showCounter: true,
showMentions: true,
desktopAlert: 'default',
desktopSound: 'chime',
mobileAlert: 'mentions',
Expand All @@ -29,6 +30,7 @@ Default.args = {
formHandlers: {
handleTurnOn: action('formHandlers.handleTurnOn'),
handleMuteGroupMentions: action('formHandlers.handleMuteGroupMentions'),
handleShowMentions: action('formHandlers.handleShowMentions'),
handleShowCounter: action('formHandlers.handleShowCounter'),
handleDesktopAlert: action('formHandlers.handleDesktopAlert'),
handleDesktopSound: action('formHandlers.handleDesktopSound'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const NotificationPreferencesWithData = ({ rid }) => {
turnOn: !subscription?.disableNotifications,
muteGroupMentions: subscription?.muteGroupMentions,
showCounter: !subscription?.hideUnreadStatus,
showMentions: !subscription?.hideMentionStatus,
desktopAlert: (subscription?.desktopPrefOrigin === 'subscription' && subscription.desktopNotifications) || 'default',
desktopSound: subscription?.audioNotificationValue || 'default',
mobileAlert: (subscription?.mobilePrefOrigin === 'subscription' && subscription.mobilePushNotifications) || 'default',
Expand Down Expand Up @@ -51,6 +52,7 @@ const NotificationPreferencesWithData = ({ rid }) => {
notifications.disableNotifications = values.turnOn ? '0' : '1';
notifications.muteGroupMentions = values.muteGroupMentions ? '1' : '0';
notifications.hideUnreadStatus = values.showCounter ? '0' : '1';
notifications.hideMentionStatus = values.showMentions ? '0' : '1';
notifications.desktopNotifications = values.desktopAlert;
notifications.audioNotificationValue = values.desktopSound;
notifications.mobilePushNotifications = values.mobileAlert;
Expand Down
6 changes: 4 additions & 2 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,10 @@
"Display_avatars": "Display Avatars",
"Display_Avatars_Sidebar": "Display Avatars in Sidebar",
"Display_chat_permissions": "Display chat permissions",
"Display_mentions_counter": "Display badge for direct mentions only",
"Display_offline_form": "Display Offline Form",
"Display_setting_permissions": "Display permissions to change settings",
"Display_unread_counter": "Display number of unread messages",
"Display_unread_counter": "Display room as unread when there are unread messages",
"Displays_action_text": "Displays action text",
"Do_It_Later": "Do It Later",
"Do_not_display_unread_counter": "Do not display any counter of this channel",
Expand Down Expand Up @@ -4001,8 +4002,9 @@
"Show_agent_info": "Show agent information",
"Show_all": "Show All",
"Show_Avatars": "Show Avatars",
"Show_counter": "Show counter",
"Show_counter": "Mark as unread",
"Show_email_field": "Show email field",
"Show_mentions": "Show badge for mentions",
"Show_Message_In_Main_Thread": "Show thread messages in the main thread",
"Show_more": "Show more",
"Show_name_field": "Show name field",
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/server/modules/watchers/publishFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const subscriptionFields = {
autoTranslateLanguage: 1,
disableNotifications: 1,
hideUnreadStatus: 1,
hideMentionStatus: 1,
muteGroupMentions: 1,
ignored: 1,
E2EKey: 1,
Expand Down
1 change: 1 addition & 0 deletions packages/core-typings/src/IRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface IRoom extends IRocketChatRecord {
unread?: number;
alert?: boolean;
hideUnreadStatus?: boolean;
hideMentionStatus?: boolean;

muted?: string[];
unmuted?: string[];
Expand Down
1 change: 1 addition & 0 deletions packages/core-typings/src/ISubscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ISubscription extends IRocketChatRecord {
f?: true;
lr: Date;
hideUnreadStatus?: true;
hideMentionStatus?: true;
teamMain?: boolean;
teamId?: string;

Expand Down