blocked chats display

This commit is contained in:
or-else
2020-04-17 14:30:26 +03:00
parent 52c1016b45
commit e5e78755ae
16 changed files with 153 additions and 51 deletions
+14 -2
View File
@@ -28,6 +28,15 @@ export default class ContactsView extends React.Component {
let unreadThreads = 0;
let archivedCount = 0;
props.chatList.map((c) => {
const blocked = c.acs && !c.acs.isJoiner();
// Show only blocked contacts only when props.blocked == true.
if (blocked && props.blocked) {
contacts.push(c);
}
if (blocked || props.blocked) {
return;
}
if (c.private && c.private.arch) {
if (props.archive) {
contacts.push(c);
@@ -39,7 +48,8 @@ export default class ContactsView extends React.Component {
unreadThreads += c.unread > 0 ? 1 : 0;
}
});
contacts.sort(function(a, b) {
contacts.sort((a, b) => {
return (b.touched || 0) - (a.touched || 0);
});
@@ -58,7 +68,9 @@ export default class ContactsView extends React.Component {
}
componentDidUpdate(prevProps, prevState) {
if (prevProps.chatList != this.props.chatList || prevProps.archive != this.props.archive) {
if (prevProps.chatList != this.props.chatList ||
prevProps.archive != this.props.archive ||
prevProps.blocked != this.props.blocked) {
const newState = ContactsView.deriveStateFromProps(this.props);
this.setState(newState);
if (newState.unreadThreads != prevState.unreadThreads) {