Skip to content
Snippets Groups Projects
Commit 1ae6738c authored by JaeeunCho's avatar JaeeunCho
Browse files

HTML5 - moved the openChats() to outside of container

parent 9036e8b7
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ export default class App extends Component {
componentDidUpdate(prevProps) {
let { unreadMessageCount, openChats, openChat } = this.props;
unreadMessageCount.forEach((chat, i) => {
// When starting the new chat, if prevProps is undefined or null, it is assigned 0.
if (!prevProps.unreadMessageCount[i]) {
......
......@@ -13,7 +13,7 @@ import NavBarContainer from '../nav-bar/container';
import ActionsBarContainer from '../actions-bar/container';
import MediaContainer from '../media/container';
import ClosedCaptionsContainer from '../closed-captions/container';
import userListService from '../user-list/service';
import UserListService from '../user-list/service';
import Auth from '/imports/ui/services/auth';
const defaultProps = {
......@@ -54,26 +54,27 @@ const setLoading = (val) => {
};
const checkUnreadMessages = () => {
return userListService.getOpenChats().map(chat=> chat.unreadCounter)
return UserListService.getOpenChats().map(chat=> chat.unreadCounter)
.filter(userID => userID !== Auth.userID);
};
const openChats = (chatID) => {
// get currently opened chatID
return UserListService.getOpenChats(chatID).map(chat => chat.id);
}
export default createContainer(({ params }) => {
Promise.all(subscribeForData())
.then(() => {
setLoading(false);
});
const openChats = () => {
return userListService.getOpenChats(params.chatID).map(chat => chat.id);
}
return {
wasKicked: wasUserKicked(),
isLoading: getLoading(),
modal: getModal(),
unreadMessageCount: checkUnreadMessages(),
openChats: openChats(),
openChats: openChats(params.chatID),
openChat: params.chatID,
getCaptionsStatus,
redirectToLogoutUrl,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment