[IMPROVEMENT] Respect "Hide counter" preference (#1306)
This commit is contained in:
parent
8bffe1f28c
commit
20a73907ff
|
@ -87,4 +87,6 @@ export default class Subscription extends Model {
|
||||||
@children('threads') threads;
|
@children('threads') threads;
|
||||||
|
|
||||||
@children('thread_messages') threadMessages;
|
@children('thread_messages') threadMessages;
|
||||||
|
|
||||||
|
@field('hide_unread_status') hideUnreadStatus;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,17 @@ export default schemaMigrations({
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
toVersion: 3,
|
||||||
|
steps: [
|
||||||
|
addColumns({
|
||||||
|
table: 'subscriptions',
|
||||||
|
columns: [
|
||||||
|
{ name: 'hide_unread_status', type: 'boolean', isOptional: true }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { appSchema, tableSchema } from '@nozbe/watermelondb';
|
import { appSchema, tableSchema } from '@nozbe/watermelondb';
|
||||||
|
|
||||||
export default appSchema({
|
export default appSchema({
|
||||||
version: 2,
|
version: 3,
|
||||||
tables: [
|
tables: [
|
||||||
tableSchema({
|
tableSchema({
|
||||||
name: 'subscriptions',
|
name: 'subscriptions',
|
||||||
|
@ -38,7 +38,8 @@ export default appSchema({
|
||||||
{ name: 'last_thread_sync', type: 'number', isOptional: true },
|
{ name: 'last_thread_sync', type: 'number', isOptional: true },
|
||||||
{ name: 'jitsi_timeout', type: 'number', isOptional: true },
|
{ name: 'jitsi_timeout', type: 'number', isOptional: true },
|
||||||
{ name: 'auto_translate', type: 'boolean', 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({
|
tableSchema({
|
||||||
|
|
|
@ -64,7 +64,8 @@ class RoomItem extends React.Component {
|
||||||
toggleFav: PropTypes.func,
|
toggleFav: PropTypes.func,
|
||||||
toggleRead: PropTypes.func,
|
toggleRead: PropTypes.func,
|
||||||
hideChannel: PropTypes.func,
|
hideChannel: PropTypes.func,
|
||||||
avatar: PropTypes.bool
|
avatar: PropTypes.bool,
|
||||||
|
hideUnreadStatus: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -218,7 +219,7 @@ class RoomItem extends React.Component {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
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;
|
} = this.props;
|
||||||
|
|
||||||
const date = formatDate(_updatedAt);
|
const date = formatDate(_updatedAt);
|
||||||
|
@ -294,7 +295,7 @@ class RoomItem extends React.Component {
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
styles.title,
|
styles.title,
|
||||||
alert && styles.alert
|
alert && !hideUnreadStatus && styles.alert
|
||||||
]}
|
]}
|
||||||
ellipsizeMode='tail'
|
ellipsizeMode='tail'
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
|
@ -305,7 +306,7 @@ class RoomItem extends React.Component {
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
styles.date,
|
styles.date,
|
||||||
alert && styles.updateAlert
|
alert && !hideUnreadStatus && styles.updateAlert
|
||||||
]}
|
]}
|
||||||
ellipsizeMode='tail'
|
ellipsizeMode='tail'
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
|
@ -320,7 +321,7 @@ class RoomItem extends React.Component {
|
||||||
type={type}
|
type={type}
|
||||||
showLastMessage={showLastMessage}
|
showLastMessage={showLastMessage}
|
||||||
username={username}
|
username={username}
|
||||||
alert={alert}
|
alert={alert && !hideUnreadStatus}
|
||||||
/>
|
/>
|
||||||
<UnreadBadge
|
<UnreadBadge
|
||||||
unread={unread}
|
unread={unread}
|
||||||
|
|
|
@ -372,7 +372,7 @@ class RoomsListView extends React.Component {
|
||||||
|
|
||||||
// unread
|
// unread
|
||||||
if (showUnread) {
|
if (showUnread) {
|
||||||
unread = chats.filter(s => s.unread > 0 || s.alert);
|
unread = chats.filter(s => (s.unread > 0 || s.alert) && !s.hideUnreadStatus);
|
||||||
} else {
|
} else {
|
||||||
unread = [];
|
unread = [];
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ class RoomsListView extends React.Component {
|
||||||
privateGroup = chats.filter(s => s.t === 'p' && !s.prid);
|
privateGroup = chats.filter(s => s.t === 'p' && !s.prid);
|
||||||
direct = chats.filter(s => s.t === 'd' && !s.prid);
|
direct = chats.filter(s => s.t === 'd' && !s.prid);
|
||||||
} else if (showUnread) {
|
} else if (showUnread) {
|
||||||
chats = chats.filter(s => !s.unread && !s.alert);
|
chats = chats.filter(s => (!s.unread && !s.alert) || s.hideUnreadStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.internalSetState({
|
this.internalSetState({
|
||||||
|
@ -606,6 +606,7 @@ class RoomsListView extends React.Component {
|
||||||
<RoomItem
|
<RoomItem
|
||||||
alert={item.alert}
|
alert={item.alert}
|
||||||
unread={item.unread}
|
unread={item.unread}
|
||||||
|
hideUnreadStatus={item.hideUnreadStatus}
|
||||||
userMentions={item.userMentions}
|
userMentions={item.userMentions}
|
||||||
isRead={this.getIsRead(item)}
|
isRead={this.getIsRead(item)}
|
||||||
favorite={item.f}
|
favorite={item.f}
|
||||||
|
|
Loading…
Reference in New Issue