Render chat unread count update in tab even when tab doesn't have focus
Render chat unread count update even when chat box has focus Render chat unread count update on page load
This commit is contained in:
parent
76f8e02fb9
commit
fa606b8040
3 changed files with 12 additions and 10 deletions
|
@ -30,6 +30,7 @@ export function fetchChats() {
|
|||
dispatch({ type: CHATS_FETCH_REQUEST });
|
||||
return api(getState).get('/api/v1/pleroma/chats').then(({ data }) => {
|
||||
dispatch({ type: CHATS_FETCH_SUCCESS, chats: data });
|
||||
chatsNotification(data);
|
||||
}).catch(error => {
|
||||
dispatch({ type: CHATS_FETCH_FAIL, error });
|
||||
});
|
||||
|
|
|
@ -36,6 +36,7 @@ class SoapboxHelmet extends React.Component {
|
|||
<Helmet
|
||||
titleTemplate={this.addCounter(`%s | ${siteTitle}`)}
|
||||
defaultTitle={this.addCounter(siteTitle)}
|
||||
defer={false}
|
||||
>
|
||||
{children}
|
||||
</Helmet>
|
||||
|
|
|
@ -80,16 +80,16 @@ class ChatBox extends ImmutablePureComponent {
|
|||
onSetInputRef(el);
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const markReadConditions = [
|
||||
() => this.props.chat !== undefined,
|
||||
() => document.activeElement === this.inputElem,
|
||||
() => this.props.chat.get('unread') > 0,
|
||||
];
|
||||
|
||||
if (markReadConditions.every(c => c() === true))
|
||||
this.markRead();
|
||||
}
|
||||
// componentDidUpdate(prevProps) {
|
||||
// const markReadConditions = [
|
||||
// () => this.props.chat !== undefined,
|
||||
// () => document.activeElement === this.inputElem,
|
||||
// () => this.props.chat.get('unread') > 0,
|
||||
// ];
|
||||
//
|
||||
// if (markReadConditions.every(c => c() === true))
|
||||
// this.markRead();
|
||||
// }
|
||||
|
||||
render() {
|
||||
const { chatMessageIds, chatId, intl } = this.props;
|
||||
|
|
Loading…
Reference in a new issue