Forums: Fix displaying as muted (#3808)
This commit is contained in:
parent
b421ac25d2
commit
c5c6207772
@ -48,7 +48,7 @@ const ChatBadge: FC<OwnProps> = ({
|
|||||||
|
|
||||||
const shouldBeMuted = useMemo(() => {
|
const shouldBeMuted = useMemo(() => {
|
||||||
const hasUnmutedUnreadTopics = chat.topics
|
const hasUnmutedUnreadTopics = chat.topics
|
||||||
&& Object.values(chat.topics).some((acc) => acc.isMuted && acc.unreadCount);
|
&& Object.values(chat.topics).some((acc) => !acc.isMuted && acc.unreadCount);
|
||||||
|
|
||||||
return isMuted || (chat.topics && !hasUnmutedUnreadTopics);
|
return isMuted || (chat.topics && !hasUnmutedUnreadTopics);
|
||||||
}, [chat, isMuted]);
|
}, [chat, isMuted]);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { addActionHandler, getGlobal, setGlobal } from '../../index';
|
import { addActionHandler, getGlobal, setGlobal } from '../../index';
|
||||||
|
|
||||||
import type { ApiUpdateChat } from '../../../api/types';
|
import type { ApiMessage, ApiUpdateChat } from '../../../api/types';
|
||||||
import type { ActionReturnType } from '../../types';
|
import type { ActionReturnType } from '../../types';
|
||||||
import { MAIN_THREAD_ID } from '../../../api/types';
|
import { MAIN_THREAD_ID } from '../../../api/types';
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ import {
|
|||||||
selectThreadParam,
|
selectThreadParam,
|
||||||
selectChatFullInfo,
|
selectChatFullInfo,
|
||||||
selectTabState,
|
selectTabState,
|
||||||
|
selectTopicFromMessage,
|
||||||
} from '../../selectors';
|
} from '../../selectors';
|
||||||
import { updateUnreadReactions } from '../../reducers/reactions';
|
import { updateUnreadReactions } from '../../reducers/reactions';
|
||||||
import { updateTabState } from '../../reducers/tabs';
|
import { updateTabState } from '../../reducers/tabs';
|
||||||
@ -143,6 +144,13 @@ addActionHandler('apiUpdate', (global, actions, update): ActionReturnType => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const topic = chat.isForum ? selectTopicFromMessage(global, message as ApiMessage) : undefined;
|
||||||
|
if (topic) {
|
||||||
|
global = updateTopic(global, update.chatId, topic.id, {
|
||||||
|
unreadCount: topic.unreadCount ? topic.unreadCount + 1 : 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
setGlobal(global);
|
setGlobal(global);
|
||||||
|
|
||||||
notifyAboutMessage({
|
notifyAboutMessage({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user