diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..1724af5 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,12 @@ + + + + + postgresql + true + org.postgresql.Driver + jdbc:postgresql://192.168.0.47:5432/postgres + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..3631d0c --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/client/src/api/contactsApi.tsx b/client/src/api/contactsApi.tsx index 91cfdf7..cd7c5cd 100644 --- a/client/src/api/contactsApi.tsx +++ b/client/src/api/contactsApi.tsx @@ -1,4 +1,4 @@ -import { ChatMessagesProps, ContactsProps } from '@/types/types.ts'; +import { ChatMessagesProps } from '@/types/types.ts'; import { axiosClient } from '@/utils/axiosClient.ts'; export async function sendContact(contact: string) { diff --git a/client/src/components/chat/chatArea/MessageElement.tsx b/client/src/components/chat/chatArea/MessageElement.tsx index db29688..ac9cf93 100644 --- a/client/src/components/chat/chatArea/MessageElement.tsx +++ b/client/src/components/chat/chatArea/MessageElement.tsx @@ -42,8 +42,8 @@ const MessageElement = ({ onDelete, message }: AnimatedMessageProps) => { const canDelete = me.isGroupOwner || - message.sender === user?.username || - (me.isGroupAdmin && me.isGroupOwner && message.sender_id !== groupOwner); + (me.isGroupAdmin && message.sender_id !== groupOwner) || + message.sender === user?.username; return (
  • {
    - {message.sender} + {message.sender} { if (currentContact) { diff --git a/client/src/context/chat/ChatProvider.tsx b/client/src/context/chat/ChatProvider.tsx index 5426d21..158f188 100644 --- a/client/src/context/chat/ChatProvider.tsx +++ b/client/src/context/chat/ChatProvider.tsx @@ -119,11 +119,13 @@ export const ChatProvider = ({ children }: { children: ReactNode }) => { try { const messages = await getMessages(contact, cursor, 50); if (messages.messages.length < 50) { + //TODO zmien to zeby byla jakas stala domyslna dla kursora setHasMoreMessages(false); setErrorMessage('No more messages found'); } messages.messages.forEach((msg) => { setMessages((prevMessages) => { + // Filter already existing messages if (!prevMessages.some((m) => m.message_id === msg.message_id)) { const messageWithDate = { ...msg,