Browse Source

fix private messages sending and geting, need to fix getting own messages merged with changes

serg1557733 1 year ago
parent
commit
06b6ca5785
2 changed files with 1 additions and 24 deletions
  1. 0 11
      backend/app.js
  2. 1 13
      frontend/src/components/chatPage/privateChat/PrivateChat.jsx

+ 0 - 11
backend/app.js

@@ -241,15 +241,8 @@ io.on("connection", async (socket) => {
     const dbUser = await getOneUser(userName);
     const allUsers = await getAllDbUsers(socket) // send allUsers from DB to socket user
     //need to use this ID to socket privat messges
-<<<<<<< HEAD
-    socket.emit('connected', dbUser); //socket.user
-
-    
-=======
  
-
     socket.emit('connected', dbUser); //socket.user
->>>>>>> new-branch
     const usersInSocket = [];
         for (let [id, socket] of io.of("/").sockets) {
             
@@ -293,10 +286,6 @@ io.on("connection", async (socket) => {
 
 socket.emit('my chats', privateChats)
 
-<<<<<<< HEAD
-=======
-  
->>>>>>> new-branch
   
     if(socket.user.isAdmin){
          getAllDbUsers(socket); 

+ 1 - 13
frontend/src/components/chatPage/privateChat/PrivateChat.jsx

@@ -11,12 +11,9 @@ import useSound from 'use-sound';
 import { PrivatChatHeader } from './PrivatChatHeader';
 import { privateMessage } from '../../../reducers/userDataReducer';
 import notifSound from '../../../assets/get.mp3'
-<<<<<<< HEAD
 import {isNewPrivateMessages} from "../../../reducers/dataReducers";
 import { UserInfoButton } from '../generalChat/UserInfoButton';
-=======
 import { YoutubeMessage } from '../YoutubeMessage';
->>>>>>> new-branch
 
 //need to fix update wenn message sendet and icon for new private messages
 
@@ -34,22 +31,13 @@ export const PrivateChat = () => {
 
     const [startMessages, setStartMessages] = useState([])   
     let endMessages = useRef(null);
-<<<<<<< HEAD
-
     socket.on('send privat messages', (messages)=> {
         setStartMessages(messages)
     });
   
 // bug need to fix****************
 
-=======
-    socket.on('send privat messages', (messages)=> {
-        setStartMessages(messages)    
-    });
-    
-    
-    
->>>>>>> new-branch
+
 
     const [isEditing, setIsEditing] = useState(false)   
     const [isEditiedMessage, setIsEditiedMessage] = useState(false) //need to type in the bottom of message after message was edited