Quick possible fix of undefined issue (#444)

This commit is contained in:
Ben Halpern 2018-06-14 14:57:00 -04:00 committed by GitHub
parent ad733aa9fe
commit da45270c88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ import ConfigImage from 'images/three-dots.svg';
const Channels = ({ activeChannelId, chatChannels, handleSwitchChannel, expanded, filterQuery, channelsLoaded }) => {
const channels = chatChannels.map((channel, index) => {
if (!channel) { return}
const isActive = parseInt(activeChannelId, 10) === channel.id
const lastOpened = channel.last_opened_at ? channel.last_opened_at : channel.channel_users[window.currentUser.username].last_opened_at
const isUnopened = (new Date(channel.last_message_at) > new Date(lastOpened)) && channel.messages_count > 0;