Skip to content

Commit

Permalink
Fix render the inappropriate messages (#168)
Browse files Browse the repository at this point in the history
* ✨ Feat(profile-picture): set/remove profile picture

feat(profile-picture): set/remove profile picture

* admin mock

* fix: adjust sixing (#158)

fix: voice notes

* fix(filter): rendering the inappropriate in chatitem

---------

Co-authored-by: Sarah Kamal <[email protected]>
  • Loading branch information
AhmedHamdiy and sarah-kamall authored Dec 21, 2024
1 parent b917960 commit cfea05a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/features/chats/MessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function MessageContent() {
const isFile = media && !(contentType === "GIF" || contentType === "sticker");
const filteredContent = isAppropriate
? content
: "🚫️ This mesaage has unappropriate content.";
: "🚫️ This mesaage has inappropriate content.";

return (
<Container>
Expand Down
4 changes: 3 additions & 1 deletion app/src/features/chats/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export function parseChatsToState(chatData?: any) {

lastMessage: {
_id: incomingLastMessage?.id,
content: incomingLastMessage?.content,
content: incomingLastMessage?.isAppropriate
? incomingLastMessage?.content
: "🚫️ This message has inappropriate content.",
senderId: incomingLastMessage?.senderId,
timestamp: incomingLastMessage?.timestamp,
contentType: incomingLastMessage?.contentType
Expand Down
11 changes: 9 additions & 2 deletions app/src/sockets/SocketProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,17 @@ function SocketProvider({ children }: SocketProviderProps) {
console.log("Failed to send", error);
}
if (success) {
console.log(recieved_message);
console.log("message sent successfully 2");
const _id = recieved_message._id;

if (
recieved_message.isAppropriate === false &&
chat?.type !== "private"
) {
toast.error("Your message was inappropriate.");
recieved_message.content =
"🚫️ This mesaage has inappropriate content.";
}

if (!chat) return;

if (chat?.type === "private") {
Expand Down

0 comments on commit cfea05a

Please sign in to comment.