[FIX] Rooms grouping not working properly (#1435)
This commit is contained in:
parent
7cdf6394fc
commit
224ff5fe44
|
@ -67,6 +67,9 @@ const CHANNELS_HEADER = 'Channels';
|
||||||
const DM_HEADER = 'Direct_Messages';
|
const DM_HEADER = 'Direct_Messages';
|
||||||
const GROUPS_HEADER = 'Private_Groups';
|
const GROUPS_HEADER = 'Private_Groups';
|
||||||
|
|
||||||
|
const filterIsUnread = s => (s.unread > 0 || s.alert) && !s.hideUnreadStatus;
|
||||||
|
const filterIsFavorite = s => s.f;
|
||||||
|
|
||||||
const shouldUpdateProps = [
|
const shouldUpdateProps = [
|
||||||
'searchText',
|
'searchText',
|
||||||
'loadingServer',
|
'loadingServer',
|
||||||
|
@ -404,13 +407,15 @@ class RoomsListView extends React.Component {
|
||||||
|
|
||||||
// unread
|
// unread
|
||||||
if (showUnread) {
|
if (showUnread) {
|
||||||
const unread = chats.filter(s => (s.unread > 0 || s.alert) && !s.hideUnreadStatus);
|
const unread = chats.filter(s => filterIsUnread(s));
|
||||||
|
chats = chats.filter(s => !filterIsUnread(s));
|
||||||
tempChats = this.addRoomsGroup(unread, UNREAD_HEADER, tempChats);
|
tempChats = this.addRoomsGroup(unread, UNREAD_HEADER, tempChats);
|
||||||
}
|
}
|
||||||
|
|
||||||
// favorites
|
// favorites
|
||||||
if (showFavorites) {
|
if (showFavorites) {
|
||||||
const favorites = chats.filter(s => s.f);
|
const favorites = chats.filter(s => filterIsFavorite(s));
|
||||||
|
chats = chats.filter(s => !filterIsFavorite(s));
|
||||||
tempChats = this.addRoomsGroup(favorites, FAVORITES_HEADER, tempChats);
|
tempChats = this.addRoomsGroup(favorites, FAVORITES_HEADER, tempChats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,11 +429,7 @@ class RoomsListView extends React.Component {
|
||||||
tempChats = this.addRoomsGroup(channels, CHANNELS_HEADER, tempChats);
|
tempChats = this.addRoomsGroup(channels, CHANNELS_HEADER, tempChats);
|
||||||
tempChats = this.addRoomsGroup(privateGroup, GROUPS_HEADER, tempChats);
|
tempChats = this.addRoomsGroup(privateGroup, GROUPS_HEADER, tempChats);
|
||||||
tempChats = this.addRoomsGroup(direct, DM_HEADER, tempChats);
|
tempChats = this.addRoomsGroup(direct, DM_HEADER, tempChats);
|
||||||
} else if (showUnread) {
|
} else if (showUnread || showFavorites) {
|
||||||
chats = chats.filter(s => (!s.unread && !s.alert) || s.hideUnreadStatus);
|
|
||||||
tempChats = this.addRoomsGroup(chats, CHATS_HEADER, tempChats);
|
|
||||||
} else if (showFavorites) {
|
|
||||||
chats = chats.filter(s => !s.f);
|
|
||||||
tempChats = this.addRoomsGroup(chats, CHATS_HEADER, tempChats);
|
tempChats = this.addRoomsGroup(chats, CHATS_HEADER, tempChats);
|
||||||
} else {
|
} else {
|
||||||
tempChats = chats;
|
tempChats = chats;
|
||||||
|
|
Loading…
Reference in New Issue