Merge branch 'invalid-chats' into 'develop'
Filter out invalid chats, fixes #648 Closes #648 See merge request soapbox-pub/soapbox-fe!517
This commit is contained in:
commit
1acfc31280
1 changed files with 5 additions and 3 deletions
|
@ -12,14 +12,16 @@ import { openChat, toggleMainWindow } from 'soapbox/actions/chats';
|
||||||
import ChatWindow from './chat_window';
|
import ChatWindow from './chat_window';
|
||||||
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
import { shortNumberFormat } from 'soapbox/utils/numbers';
|
||||||
import AudioToggle from 'soapbox/features/chats/components/audio_toggle';
|
import AudioToggle from 'soapbox/features/chats/components/audio_toggle';
|
||||||
|
import { List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
const addChatsToPanes = (state, panesData) => {
|
const addChatsToPanes = (state, panesData) => {
|
||||||
const getChat = makeGetChat();
|
const getChat = makeGetChat();
|
||||||
|
|
||||||
const newPanes = panesData.get('panes').map(pane => {
|
const newPanes = panesData.get('panes').reduce((acc, pane) => {
|
||||||
const chat = getChat(state, { id: pane.get('chat_id') });
|
const chat = getChat(state, { id: pane.get('chat_id') });
|
||||||
return pane.set('chat', chat);
|
if (!chat) return acc;
|
||||||
});
|
return acc.push(pane.set('chat', chat));
|
||||||
|
}, ImmutableList());
|
||||||
|
|
||||||
return panesData.set('panes', newPanes);
|
return panesData.set('panes', newPanes);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue