fix: join upon friend add
This commit is contained in:
parent
375a00cfe4
commit
d30103d375
8
src/client/store/effects.js
vendored
8
src/client/store/effects.js
vendored
|
@ -35,6 +35,7 @@ import {
|
|||
} from '../../common/state/user';
|
||||
import {
|
||||
fetchUsernames,
|
||||
usernamesSelector,
|
||||
} from '~/common/state/usernames';
|
||||
|
||||
import {socket} from '~/client/hooks/useSocket';
|
||||
|
@ -43,6 +44,13 @@ const effects = {
|
|||
[addFriendship]: ({dispatch}, {payload: {addeeId, adderId}}) => {
|
||||
dispatch(fetchUsernames([addeeId, adderId]));
|
||||
},
|
||||
[confirmFriendship]: ({dispatch, getState}, {payload: {addeeId, adderId}}) => {
|
||||
const state = getState();
|
||||
const id = idSelector(state);
|
||||
const otherId = id === addeeId ? adderId : addeeId;
|
||||
const name = usernamesSelector(state)[otherId];
|
||||
dispatch(submitJoin({channel: `/u/${name}`, id}));
|
||||
},
|
||||
[join]: ({dispatch}, {payload: {messages, users}}) => {
|
||||
const ids = new Set();
|
||||
Object.values(messages).map((message) => message.owner).forEach((id) => ids.add(id));
|
||||
|
|
Loading…
Reference in New Issue
Block a user