forked from Ivasoft/mattermost-mobile
Count fix (#6926)
This commit is contained in:
committed by
GitHub
parent
5ff22953ab
commit
ed69eacbe7
@@ -23,6 +23,7 @@ export default class MyChannelModel extends Model implements MyChannelModelInter
|
||||
static associations: Associations = {
|
||||
[CHANNEL]: {type: 'belongs_to', key: 'id'},
|
||||
[CATEGORY_CHANNEL]: {type: 'has_many', foreignKey: 'channel_id'},
|
||||
[MY_CHANNEL_SETTINGS]: {type: 'has_many', foreignKey: 'id'},
|
||||
};
|
||||
|
||||
/** last_post_at : The timestamp for any last post on this channel */
|
||||
|
||||
@@ -465,6 +465,7 @@ export function observeMyChannelMentionCount(database: Database, teamId?: string
|
||||
Q.on(CHANNEL, Q.and(
|
||||
...conditions,
|
||||
)),
|
||||
Q.on(MY_CHANNEL_SETTINGS, Q.where('notify_props', Q.notLike('%"mark_unread":"mention"%'))),
|
||||
).
|
||||
observeWithColumns(columns).
|
||||
pipe(
|
||||
|
||||
@@ -63,7 +63,7 @@ const Servers = React.forwardRef<ServersRef>((props, ref) => {
|
||||
let unread = Boolean(threadUnreads);
|
||||
for (const myChannel of myChannels) {
|
||||
const isMuted = settings?.[myChannel.id]?.mark_unread === 'mention';
|
||||
mentions += myChannel.mentionsCount;
|
||||
mentions += isMuted ? 0 : myChannel.mentionsCount;
|
||||
unread = unread || (myChannel.isUnread && !isMuted);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ const ServerItem = ({
|
||||
let isUnread = Boolean(threadUnreads);
|
||||
for (const myChannel of myChannels) {
|
||||
const isMuted = settings?.[myChannel.id]?.mark_unread === 'mention';
|
||||
mentions += myChannel.mentionsCount;
|
||||
mentions += isMuted ? 0 : myChannel.mentionsCount;
|
||||
isUnread = isUnread || (myChannel.isUnread && !isMuted);
|
||||
}
|
||||
mentions += threadMentionCount;
|
||||
|
||||
@@ -71,7 +71,7 @@ const Home = ({isFocused, theme}: Props) => {
|
||||
let unread = false;
|
||||
for (const myChannel of myChannels) {
|
||||
const isMuted = settings?.[myChannel.id]?.mark_unread === 'mention';
|
||||
mentions += myChannel.mentionsCount;
|
||||
mentions += isMuted ? 0 : myChannel.mentionsCount;
|
||||
unread = unread || (myChannel.isUnread && !isMuted);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,9 @@ extension Database {
|
||||
let stmtString = """
|
||||
SELECT SUM(my.mentions_count) \
|
||||
FROM MyChannel my \
|
||||
INNER JOIN MyChannelSettings mys ON mys.id=my.id \
|
||||
INNER JOIN Channel c ON c.id=my.id \
|
||||
WHERE c.delete_at = 0
|
||||
WHERE c.delete_at = 0 AND mys.notify_props NOT LIKE '%"mark_unread":"mention"%'
|
||||
"""
|
||||
let mentions = try? db.prepare(stmtString).scalar() as? Double
|
||||
return Int(mentions ?? 0)
|
||||
|
||||
Reference in New Issue
Block a user