diff --git a/src/app/slices/channels.js b/src/app/slices/channels.js index 391dc88a..e62a60f3 100644 --- a/src/app/slices/channels.js +++ b/src/app/slices/channels.js @@ -29,8 +29,16 @@ const channelsSlice = createSlice({ state.byId[gid] = rest; }, updateChannel(state, action) { + const ignoreInPublic = ["add_member", "remove_member"]; // console.log("set channels store", action); - const { id, operation, members, ...rest } = action.payload; + const { id, operation, members = [], ...rest } = action.payload; + const currChannel = state.byId[id]; + if ( + !currChannel || + (currChannel.is_public && ignoreInPublic.includes(operation)) + ) + return; + switch (operation) { case "remove_member": { diff --git a/src/routes/chat/ChannelChat/index.js b/src/routes/chat/ChannelChat/index.js index 768360a7..0b93d1fb 100644 --- a/src/routes/chat/ChannelChat/index.js +++ b/src/routes/chat/ChannelChat/index.js @@ -56,7 +56,7 @@ export default function ChannelChat({ cid = "", dropFiles = [] }) { }; const { name, description, is_public, members = [] } = data; - const memberIds = members.length == 0 ? userIds : members; + const memberIds = is_public ? userIds : members; console.log("channel message list", msgIds); const readIndex = footprint.readChannels[cid]; return (