chore: updates

This commit is contained in:
Tristan Yang
2024-09-13 09:32:26 +08:00
parent 28722de616
commit b2fe399ce5
5 changed files with 18 additions and 16 deletions
+9 -3
View File
@@ -1,8 +1,9 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { isNull, omitBy } from "lodash";
import { omitBy } from "lodash";
import { Channel, UpdateChannelDTO, UpdatePinnedMessageDTO } from "@/types/channel";
import BASE_URL from "../config";
import { isUndefinedOrNull } from "@udecode/plate-common";
// import { updateVoicingInfo } from "./voice";
@@ -74,8 +75,13 @@ const channelsSlice = createSlice({
break;
}
default:
// old code: state.byId[gid] = { ...state.byId[gid]!, ...getNonNullValues(rest) };
state.byId[gid] = { ...state.byId[gid]!, ...omitBy(rest, isNull) };
{
const wtf = omitBy(rest, isUndefinedOrNull);
console.log("rrrr", wtf);
// old code: state.byId[gid] = { ...state.byId[gid]!, ...getNonNullValues(rest) };
state.byId[gid] = { ...state.byId[gid]!, ...wtf };
}
break;
}
},
+3 -7
View File
@@ -146,13 +146,9 @@ const Send: FC<IProps> = ({
const onlyOwnerCanSend = !!(context == "channel"
? channelsData[id]?.only_owner_can_send_msg
: false);
const canSendMessageInChannel = !isChannelOwner && onlyOwnerCanSend;
if (canSendMessageInChannel) {
return (
<div className="p-5 uppercase bg-gray-200 rounded-lg w-fit dark:bg-gray-600 text-red-300">
only Channel owner can send message!
</div>
);
const canNotSendMessageInChannel = !isChannelOwner && onlyOwnerCanSend;
if (canNotSendMessageInChannel) {
return null;
}
if (context == "dm" && blocked) {
return (