diff --git a/app/containers/RoomItem/RoomItem.tsx b/app/containers/RoomItem/RoomItem.tsx
index 03341f072..d996b9707 100644
--- a/app/containers/RoomItem/RoomItem.tsx
+++ b/app/containers/RoomItem/RoomItem.tsx
@@ -52,7 +52,8 @@ const RoomItem = ({
autoJoin,
showAvatar,
displayMode,
- sourceType
+ sourceType,
+ hideMentionStatus
}: IRoomItemProps) => (
>
@@ -143,6 +146,8 @@ const RoomItem = ({
tunread={tunread}
tunreadUser={tunreadUser}
tunreadGroup={tunreadGroup}
+ hideMentionStatus={hideMentionStatus}
+ hideUnreadStatus={hideUnreadStatus}
/>
diff --git a/app/containers/RoomItem/index.tsx b/app/containers/RoomItem/index.tsx
index 4dd4f9786..7a7a29deb 100644
--- a/app/containers/RoomItem/index.tsx
+++ b/app/containers/RoomItem/index.tsx
@@ -167,6 +167,7 @@ class RoomItemContainer extends React.Component {
prid={item.prid}
status={status}
hideUnreadStatus={item.hideUnreadStatus}
+ hideMentionStatus={item.hideMentionStatus}
alert={alert}
lastMessage={item.lastMessage}
showLastMessage={showLastMessage}
diff --git a/app/containers/RoomItem/interfaces.ts b/app/containers/RoomItem/interfaces.ts
index b72284d6b..7f698242f 100644
--- a/app/containers/RoomItem/interfaces.ts
+++ b/app/containers/RoomItem/interfaces.ts
@@ -132,6 +132,7 @@ export interface IRoomItemProps {
showAvatar: boolean;
displayMode: string;
sourceType: IOmnichannelSource;
+ hideMentionStatus?: boolean;
}
export interface ILastMessageProps {
diff --git a/app/containers/UnreadBadge/index.tsx b/app/containers/UnreadBadge/index.tsx
index d9be1e0da..e0ff61ce8 100644
--- a/app/containers/UnreadBadge/index.tsx
+++ b/app/containers/UnreadBadge/index.tsx
@@ -38,16 +38,38 @@ export interface IUnreadBadge {
tunreadUser?: [];
tunreadGroup?: [];
small?: boolean;
+ hideUnreadStatus?: boolean;
+ hideMentionStatus?: boolean;
}
const UnreadBadge = React.memo(
- ({ unread, userMentions, groupMentions, style, tunread, tunreadUser, tunreadGroup, small }: IUnreadBadge) => {
+ ({
+ unread,
+ userMentions,
+ groupMentions,
+ style,
+ tunread,
+ tunreadUser,
+ tunreadGroup,
+ small,
+ hideMentionStatus,
+ hideUnreadStatus
+ }: IUnreadBadge) => {
const { theme } = useTheme();
if ((!unread || unread <= 0) && !tunread?.length) {
return null;
}
+ if (hideUnreadStatus && hideMentionStatus) {
+ return null;
+ }
+
+ // Return null when hideUnreadStatus is true and isn't a direct mention
+ if (hideUnreadStatus && !((userMentions && userMentions > 0) || tunreadUser?.length)) {
+ return null;
+ }
+
const { backgroundColor, color } = getUnreadStyle({
theme,
unread,
diff --git a/app/definitions/ISubscription.ts b/app/definitions/ISubscription.ts
index e2e6f2739..ee84c17be 100644
--- a/app/definitions/ISubscription.ts
+++ b/app/definitions/ISubscription.ts
@@ -100,6 +100,7 @@ export interface ISubscription {
separator?: boolean;
onHold?: boolean;
source?: IOmnichannelSource;
+ hideMentionStatus?: boolean;
// https://nozbe.github.io/WatermelonDB/Relation.html#relation-api
messages: RelationModified;
threads: RelationModified;
diff --git a/app/i18n/locales/ar.json b/app/i18n/locales/ar.json
index 82029db29..2315fbf7e 100644
--- a/app/i18n/locales/ar.json
+++ b/app/i18n/locales/ar.json
@@ -489,8 +489,6 @@
"Share_Link": "مشاركة رابط",
"Share_this_app": "مشاركة هذا البرنامج",
"Show_more": "إظهار أكثر..",
- "Show_Unread_Counter": "عرض عدد الرسائل غير المقروءة",
- "Show_Unread_Counter_Info": "يتم عرض العدد غير المقروء كشارة على يمين القناة في القائمة",
"Sign_in_your_server": "تسجيل الدخول إلى الخادم الخاص بك",
"Sign_Up": "تسجيل جديد",
"Some_field_is_invalid_or_empty": "بعض الحقول غير صالحة أو فارغة",
diff --git a/app/i18n/locales/de.json b/app/i18n/locales/de.json
index 12b186047..17e7ad23e 100644
--- a/app/i18n/locales/de.json
+++ b/app/i18n/locales/de.json
@@ -495,8 +495,6 @@
"Share_Link": "Link teilen",
"Share_this_app": "App teilen",
"Show_more": "Mehr anzeigen …",
- "Show_Unread_Counter": "Zähler anzeigen",
- "Show_Unread_Counter_Info": "Anzahl der ungelesenen Nachrichten anzeigen",
"Sign_in_your_server": "Melden Sie sich bei Ihrem Server an",
"Sign_Up": "Anmelden",
"Some_field_is_invalid_or_empty": "Ein Feld ist ungültig oder leer",
diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json
index 5fa60c40f..c83aa5ed1 100644
--- a/app/i18n/locales/en.json
+++ b/app/i18n/locales/en.json
@@ -504,8 +504,6 @@
"Share_Link": "Share Link",
"Share_this_app": "Share this app",
"Show_more": "Show more..",
- "Show_Unread_Counter": "Show Unread Counter",
- "Show_Unread_Counter_Info": "Unread counter is displayed as a badge on the right of the channel, in the list",
"Sign_in_your_server": "Sign in your server",
"Sign_Up": "Sign Up",
"Some_field_is_invalid_or_empty": "Some field is invalid or empty",
@@ -825,5 +823,9 @@
"Omnichannel_placed_chat_on_hold": "Chat On Hold: {{comment}}",
"Omnichannel_on_hold_chat_resumed": "On Hold Chat Resumed: {{comment}}",
"Omnichannel_queue": "Omnichannel queue",
- "Empty": "Empty"
+ "Empty": "Empty",
+ "Mark_as_unread": "Mark as unread",
+ "Mark_as_unread_Info": "Display room as unread when there are unread messages",
+ "Show_badge_for_mentions": "Show badge for mentions",
+ "Show_badge_for_mentions_Info": "Display badge for direct mentions only"
}
\ No newline at end of file
diff --git a/app/i18n/locales/es-ES.json b/app/i18n/locales/es-ES.json
index f75061579..81fa6194e 100644
--- a/app/i18n/locales/es-ES.json
+++ b/app/i18n/locales/es-ES.json
@@ -344,8 +344,6 @@
"Settings_succesfully_changed": "¡Configuración cambiada correctamente!",
"Share": "Compartir",
"Share_this_app": "Compartir esta aplicación",
- "Show_Unread_Counter": "Mostrar contador de no leídos",
- "Show_Unread_Counter_Info": "El contador de no leídos se muestra como una insignia a la derecha del canal, en la lista",
"Sign_in_your_server": "Accede a tu servidor",
"Sign_Up": "Registrarse",
"Some_field_is_invalid_or_empty": "Algún campo no es correcto o está vacío",
diff --git a/app/i18n/locales/fr.json b/app/i18n/locales/fr.json
index 089264f08..3136cd4f1 100644
--- a/app/i18n/locales/fr.json
+++ b/app/i18n/locales/fr.json
@@ -495,8 +495,6 @@
"Share_Link": "Partager le lien",
"Share_this_app": "Partager cette application",
"Show_more": "Afficher plus..",
- "Show_Unread_Counter": "Afficher le compteur non lu",
- "Show_Unread_Counter_Info": "Le compteur non lu est affiché sous forme de badge à droite du canal, dans la liste",
"Sign_in_your_server": "Connectez-vous à votre serveur",
"Sign_Up": "S'inscrire",
"Some_field_is_invalid_or_empty": "Certains champs sont invalides ou vides",
diff --git a/app/i18n/locales/it.json b/app/i18n/locales/it.json
index 52c8af272..9617911ad 100644
--- a/app/i18n/locales/it.json
+++ b/app/i18n/locales/it.json
@@ -483,8 +483,6 @@
"Share_Link": "Condividi link",
"Share_this_app": "Condividi questa app",
"Show_more": "Mostra altri..",
- "Show_Unread_Counter": "Mostra contatore messaggi non letti",
- "Show_Unread_Counter_Info": "Il contatore viene mostrato come un'etichetta alla destra del canale, nella lista",
"Sign_in_your_server": "Accedi al tuo server",
"Sign_Up": "Registrati",
"Some_field_is_invalid_or_empty": "Un campo non è valido o è vuoto",
diff --git a/app/i18n/locales/ja.json b/app/i18n/locales/ja.json
index 1e1d1bd34..1367a4be5 100644
--- a/app/i18n/locales/ja.json
+++ b/app/i18n/locales/ja.json
@@ -452,8 +452,6 @@
"Share_Link": "リンクをシェアする",
"Share_this_app": "このアプリをシェアする",
"Show_more": "Show more..",
- "Show_Unread_Counter": "未読件数を表示する",
- "Show_Unread_Counter_Info": "未読件数はリスト上で、チャンネルの右側にバッジで表示されます。",
"Sign_in_your_server": "サーバーに接続",
"Sign_Up": "登録",
"Some_field_is_invalid_or_empty": "不正、または空の入力欄があります。",
diff --git a/app/i18n/locales/nl.json b/app/i18n/locales/nl.json
index ccac7069d..87d9bb00a 100644
--- a/app/i18n/locales/nl.json
+++ b/app/i18n/locales/nl.json
@@ -495,8 +495,6 @@
"Share_Link": "Deel link",
"Share_this_app": "Deel deze app",
"Show_more": "Meer tonen..",
- "Show_Unread_Counter": "Toon ongelezen teller",
- "Show_Unread_Counter_Info": "Ongelezen teller wordt weergegeven als een badge aan de rechterkant van het kanaal, in de lijst",
"Sign_in_your_server": "Log in op je server",
"Sign_Up": "Registreren",
"Some_field_is_invalid_or_empty": "Sommige velden zijn ongeldig of leeg",
diff --git a/app/i18n/locales/pt-BR.json b/app/i18n/locales/pt-BR.json
index 3a2d534a0..4b5098b89 100644
--- a/app/i18n/locales/pt-BR.json
+++ b/app/i18n/locales/pt-BR.json
@@ -463,8 +463,6 @@
"Share": "Compartilhar",
"Share_Link": "Share Link",
"Show_more": "Mostrar mais..",
- "Show_Unread_Counter": "Mostrar contador não lido",
- "Show_Unread_Counter_Info": "O contador não lido é exibido como um emblema à direita do canal, na lista",
"Sign_in_your_server": "Entrar no seu servidor",
"Sign_Up": "Registrar",
"Some_field_is_invalid_or_empty": "Algum campo está inválido ou vazio",
diff --git a/app/i18n/locales/ru.json b/app/i18n/locales/ru.json
index 94a323444..f64a335ce 100644
--- a/app/i18n/locales/ru.json
+++ b/app/i18n/locales/ru.json
@@ -495,8 +495,6 @@
"Share_Link": "Ссылка, чтобы Поделиться",
"Share_this_app": "Рассказать о приложении",
"Show_more": "Показать больше..",
- "Show_Unread_Counter": "Показать счетчик непрочитанных",
- "Show_Unread_Counter_Info": "Счетчик непрочитанных отображается в виде значка справа от канала в списке каналов",
"Sign_in_your_server": "Войдите на ваш сервер",
"Sign_Up": "Регистрация",
"Some_field_is_invalid_or_empty": "Некоторые поля недопустимы или пусты",
diff --git a/app/i18n/locales/tr.json b/app/i18n/locales/tr.json
index 10dfcb4cd..092dbfda6 100644
--- a/app/i18n/locales/tr.json
+++ b/app/i18n/locales/tr.json
@@ -483,8 +483,6 @@
"Share_Link": "Bağlantı paylaş",
"Share_this_app": "Bu uygulamayı paylaş",
"Show_more": "Daha fazla göster..",
- "Show_Unread_Counter": "Okunmamış Sayacını Göster",
- "Show_Unread_Counter_Info": "Okunmamış sayacı, listede kanalın sağ tarafında bir rozet olarak görüntülenir",
"Sign_in_your_server": "Sunucunuzda oturum açın",
"Sign_Up": "Kaydol",
"Some_field_is_invalid_or_empty": "Bazı alanlar geçersiz veya boş",
diff --git a/app/i18n/locales/zh-CN.json b/app/i18n/locales/zh-CN.json
index 0b850b959..119dfdf6c 100644
--- a/app/i18n/locales/zh-CN.json
+++ b/app/i18n/locales/zh-CN.json
@@ -481,8 +481,6 @@
"Share_Link": "分享链接",
"Share_this_app": "分享此 app",
"Show_more": "显示更多",
- "Show_Unread_Counter": "显示未读信息数量",
- "Show_Unread_Counter_Info": "显示未读信息数量资讯",
"Sign_in_your_server": "登录你的服务器",
"Sign_Up": "注册",
"Some_field_is_invalid_or_empty": "某些字段无效或为空",
diff --git a/app/i18n/locales/zh-TW.json b/app/i18n/locales/zh-TW.json
index 7110d2f0d..4e8827ed6 100644
--- a/app/i18n/locales/zh-TW.json
+++ b/app/i18n/locales/zh-TW.json
@@ -483,8 +483,6 @@
"Share_Link": "分享連結",
"Share_this_app": "分享此 app",
"Show_more": "顯示更多",
- "Show_Unread_Counter": "顯示未讀訊息數量",
- "Show_Unread_Counter_Info": "顯示未讀訊息數量資訊",
"Sign_in_your_server": "登錄你的伺服器",
"Sign_Up": "註冊",
"Some_field_is_invalid_or_empty": "某些字段無效或為空",
diff --git a/app/lib/database/model/Subscription.js b/app/lib/database/model/Subscription.js
index 46f990562..26fb764d7 100644
--- a/app/lib/database/model/Subscription.js
+++ b/app/lib/database/model/Subscription.js
@@ -103,6 +103,8 @@ export default class Subscription extends Model {
@field('hide_unread_status') hideUnreadStatus;
+ @field('hide_mention_status') hideMentionStatus;
+
@json('sys_mes', sanitizer) sysMes;
@json('uids', sanitizer) uids;
diff --git a/app/lib/database/model/migrations.js b/app/lib/database/model/migrations.js
index 8aa813f4d..aacbd5903 100644
--- a/app/lib/database/model/migrations.js
+++ b/app/lib/database/model/migrations.js
@@ -230,6 +230,15 @@ export default schemaMigrations({
columns: [{ name: 'comment', type: 'string', isOptional: true }]
})
]
+ },
+ {
+ toVersion: 18,
+ steps: [
+ addColumns({
+ table: 'subscriptions',
+ columns: [{ name: 'hide_mention_status', type: 'boolean', isOptional: true }]
+ })
+ ]
}
]
});
diff --git a/app/lib/database/schema/app.js b/app/lib/database/schema/app.js
index dac45346c..6380084af 100644
--- a/app/lib/database/schema/app.js
+++ b/app/lib/database/schema/app.js
@@ -1,7 +1,7 @@
import { appSchema, tableSchema } from '@nozbe/watermelondb';
export default appSchema({
- version: 17,
+ version: 18,
tables: [
tableSchema({
name: 'subscriptions',
@@ -61,7 +61,8 @@ export default appSchema({
{ name: 'team_id', type: 'string', isIndexed: true },
{ name: 'team_main', type: 'boolean', isOptional: true }, // Use `Q.notEq(true)` to get false or null
{ name: 'on_hold', type: 'boolean', isOptional: true },
- { name: 'source', type: 'string', isOptional: true }
+ { name: 'source', type: 'string', isOptional: true },
+ { name: 'hide_mention_status', type: 'boolean', isOptional: true }
]
}),
tableSchema({
diff --git a/app/lib/methods/helpers/mergeSubscriptionsRooms.ts b/app/lib/methods/helpers/mergeSubscriptionsRooms.ts
index f1380f1f7..6763298f2 100644
--- a/app/lib/methods/helpers/mergeSubscriptionsRooms.ts
+++ b/app/lib/methods/helpers/mergeSubscriptionsRooms.ts
@@ -97,6 +97,8 @@ export const merge = (
mergedSubscription.blocker = !!mergedSubscription.blocker;
mergedSubscription.blocked = !!mergedSubscription.blocked;
+ mergedSubscription.hideMentionStatus = !!mergedSubscription.hideMentionStatus;
+
return mergedSubscription;
};
diff --git a/app/lib/methods/subscriptions/rooms.ts b/app/lib/methods/subscriptions/rooms.ts
index 1c9a9e654..bd5f2b425 100644
--- a/app/lib/methods/subscriptions/rooms.ts
+++ b/app/lib/methods/subscriptions/rooms.ts
@@ -103,7 +103,8 @@ const createOrUpdateSubscription = async (subscription: ISubscription, room: ISe
e2eKeyId: s.e2eKeyId,
E2EKey: s.E2EKey,
avatarETag: s.avatarETag,
- onHold: s.onHold
+ onHold: s.onHold,
+ hideMentionStatus: s.hideMentionStatus
} as ISubscription;
} catch (error) {
try {
diff --git a/app/views/NotificationPreferencesView/index.tsx b/app/views/NotificationPreferencesView/index.tsx
index d9e0d3142..aa2931f0f 100644
--- a/app/views/NotificationPreferencesView/index.tsx
+++ b/app/views/NotificationPreferencesView/index.tsx
@@ -3,6 +3,7 @@ import { StyleSheet, Switch, Text } from 'react-native';
import { RouteProp } from '@react-navigation/core';
import { StackNavigationProp } from '@react-navigation/stack';
import { Observable, Subscription } from 'rxjs';
+import { connect } from 'react-redux';
import database from '../../lib/database';
import { SWITCH_TRACK_COLOR, themes } from '../../lib/constants';
@@ -16,8 +17,9 @@ import log, { events, logEvent } from '../../lib/methods/helpers/log';
import sharedStyles from '../Styles';
import { IOptionsField, OPTIONS } from './options';
import { ChatsStackParamList } from '../../stacks/types';
-import { IRoomNotifications, TRoomNotificationsModel } from '../../definitions';
+import { IApplicationState, IRoomNotifications, TRoomNotificationsModel } from '../../definitions';
import { Services } from '../../lib/services';
+import { compareServerVersion } from '../../lib/methods/helpers/compareServerVersion';
const styles = StyleSheet.create({
pickerText: {
@@ -30,6 +32,7 @@ interface INotificationPreferencesViewProps {
navigation: StackNavigationProp;
route: RouteProp;
theme: TSupportedThemes;
+ serverVersion: string | null;
}
interface INotificationPreferencesViewState {
@@ -155,6 +158,7 @@ class NotificationPreferencesView extends React.Component
@@ -185,14 +189,27 @@ class NotificationPreferencesView extends React.Component
this.renderSwitch('hideUnreadStatus')}
/>
-
+
+ {room.hideUnreadStatus && compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '4.8.0') ? (
+
+
+ this.renderSwitch('hideMentionStatus')}
+ />
+
+
+
+ ) : null}
+
({
+ serverVersion: state.server.version
+});
+
+export default connect(mapStateToProps)(withTheme(NotificationPreferencesView));
diff --git a/e2e/tests/room/03-roomactions.spec.js b/e2e/tests/room/03-roomactions.spec.js
index e00898761..406129b7a 100644
--- a/e2e/tests/room/03-roomactions.spec.js
+++ b/e2e/tests/room/03-roomactions.spec.js
@@ -287,7 +287,7 @@ describe('Room actions screen', () => {
});
it('should have show unread count option', async () => {
- await expect(element(by.id('notification-preference-view-unread-count'))).toExist();
+ await expect(element(by.id('notification-preference-view-mark-as-unread'))).toExist();
});
it('should have notification alert option', async () => {