diff --git a/app/lib/database/model/Subscription.js b/app/lib/database/model/Subscription.js index 577bec584..630c640b3 100644 --- a/app/lib/database/model/Subscription.js +++ b/app/lib/database/model/Subscription.js @@ -87,4 +87,6 @@ export default class Subscription extends Model { @children('threads') threads; @children('thread_messages') threadMessages; + + @field('hide_unread_status') hideUnreadStatus; } diff --git a/app/lib/database/model/migrations.js b/app/lib/database/model/migrations.js index f3a7f57b5..3c78dec36 100644 --- a/app/lib/database/model/migrations.js +++ b/app/lib/database/model/migrations.js @@ -12,6 +12,17 @@ export default schemaMigrations({ ] }) ] + }, + { + toVersion: 3, + steps: [ + addColumns({ + table: 'subscriptions', + columns: [ + { name: 'hide_unread_status', type: 'boolean', isOptional: true } + ] + }) + ] } ] }); diff --git a/app/lib/database/schema/app.js b/app/lib/database/schema/app.js index 563d2fed2..8e38f76a6 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: 2, + version: 3, tables: [ tableSchema({ name: 'subscriptions', @@ -38,7 +38,8 @@ export default appSchema({ { name: 'last_thread_sync', type: 'number', isOptional: true }, { name: 'jitsi_timeout', type: 'number', isOptional: true }, { name: 'auto_translate', type: 'boolean', isOptional: true }, - { name: 'auto_translate_language', type: 'string' } + { name: 'auto_translate_language', type: 'string' }, + { name: 'hide_unread_status', type: 'boolean', isOptional: true } ] }), tableSchema({ diff --git a/app/presentation/RoomItem/index.js b/app/presentation/RoomItem/index.js index f0e05a3b1..c340ba964 100644 --- a/app/presentation/RoomItem/index.js +++ b/app/presentation/RoomItem/index.js @@ -64,7 +64,8 @@ class RoomItem extends React.Component { toggleFav: PropTypes.func, toggleRead: PropTypes.func, hideChannel: PropTypes.func, - avatar: PropTypes.bool + avatar: PropTypes.bool, + hideUnreadStatus: PropTypes.bool } static defaultProps = { @@ -218,7 +219,7 @@ class RoomItem extends React.Component { render() { const { - unread, userMentions, name, _updatedAt, alert, testID, type, avatarSize, baseUrl, userId, username, token, id, prid, showLastMessage, lastMessage, isRead, width, favorite, status, avatar + unread, userMentions, name, _updatedAt, alert, testID, type, avatarSize, baseUrl, userId, username, token, id, prid, showLastMessage, lastMessage, isRead, width, favorite, status, avatar, hideUnreadStatus } = this.props; const date = formatDate(_updatedAt); @@ -294,7 +295,7 @@ class RoomItem extends React.Component { s.unread > 0 || s.alert); + unread = chats.filter(s => (s.unread > 0 || s.alert) && !s.hideUnreadStatus); } else { unread = []; } @@ -391,7 +391,7 @@ class RoomsListView extends React.Component { privateGroup = chats.filter(s => s.t === 'p' && !s.prid); direct = chats.filter(s => s.t === 'd' && !s.prid); } else if (showUnread) { - chats = chats.filter(s => !s.unread && !s.alert); + chats = chats.filter(s => (!s.unread && !s.alert) || s.hideUnreadStatus); } this.internalSetState({ @@ -606,6 +606,7 @@ class RoomsListView extends React.Component {