Progress on dms, code cleanup

Progress on dms, code cleanup
This commit is contained in:
mgabdev
2020-12-02 23:22:51 -05:00
parent 20d4fc09af
commit 9a43c51085
103 changed files with 3656 additions and 859 deletions

View File

@@ -20,6 +20,49 @@ export const makeGetAccount = () => {
});
};
export const makeGetChatMessage = () => {
return createSelector(
[
(state) => state,
(state, { id }) => state.getIn(['chat_messages', id]),
(state, { id }) => state.getIn(['accounts', `${state.getIn(['chat_messages', `${id}`, 'from_account_id'])}`]),
],
(state, base, account) => {
if (!base) return null
return base.withMutations((map) => {
map.set('account', account)
})
}
)
}
export const makeGetChatConversation = () => {
return createSelector(
[
(state) => state,
(state, { id }) => state.getIn(['chat_conversations', `${id}`]),
(state) => state.get('accounts'),
],
(state, base, allAccounts) => {
if (!base) return null
let otherAccounts = ImmutableList()
if (allAccounts) {
base.get('other_account_ids').forEach((acctId) => {
const acct = allAccounts.get(`${acctId}`, null)
if (acct) {
otherAccounts = otherAccounts.set(otherAccounts.size, acct)
}
})
}
return base.withMutations((map) => {
map.set('other_accounts', otherAccounts)
})
}
)
}
const toServerSideType = columnType => {
switch (columnType) {
case 'home':