From 52760193117a329a84b839d01445f345428e603d Mon Sep 17 00:00:00 2001 From: Naddeo Eddy Date: Thu, 12 Dec 2024 10:46:26 +0100 Subject: [PATCH 1/3] Upscaling file upload size to 1Go --- app/Http/Controllers/ChatController.php | 2 +- resources/views/dashboard.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index f95e69c..daf3436 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -85,7 +85,7 @@ public function storeCapsule(Request $request, $chatId) { // Validation $request->validate([ - 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4|max:1024', + 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4|max:1048576', 'message' => 'required|string', ]); diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 356a2bc..a2c09df 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -183,4 +183,4 @@ function scrollToBottom() { } startAutoRefresh(); // Démarrer l'auto-rafraîchissement - + \ No newline at end of file From 7a606b32a656df2ec914a9ab0d11c19bb7a02b97 Mon Sep 17 00:00:00 2001 From: Naddeo Eddy Date: Thu, 12 Dec 2024 10:52:42 +0100 Subject: [PATCH 2/3] Correcting height detection --- resources/views/dashboard.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index a2c09df..adf8836 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -76,8 +76,8 @@ function loadChat(chatId, discussionName, discussionPicture, newOpening = true) // Récupérer la position dans le scroll et vérifier si on est tout en bas // Utile pour savoir si on doit défiler jusqu'en bas après l'ajout des nouveaux messages ou si l'utilisateur est entrain de consulter des anciens messages - const isAtBottom = messagesContainer.scrollHeight - messagesContainer.scrollTop === messagesContainer.clientHeight; - + const isAtBottom = messagesContainer.scrollHeight - messagesContainer.scrollTop <= messagesContainer.clientHeight + 0.6; + // Parcourir les messages et les ajouter newMessages.forEach(message => { const isCurrentUser = message.user_id === {{ auth()->id() }}; From 0009156483b9e9e93799b1242c81e99d0a25901b Mon Sep 17 00:00:00 2001 From: Naddeo Eddy Date: Thu, 12 Dec 2024 11:43:59 +0100 Subject: [PATCH 3/3] Adding .mov and reseting file input after sending it --- app/Http/Controllers/ChatController.php | 11 ++++++++--- .../views/components/messaging/chatbar.blade.php | 15 +++++++++++---- resources/views/dashboard.blade.php | 6 +++--- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index daf3436..f54aabe 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -60,7 +60,7 @@ public function index() public function getMessages($chatId) { $messages = Message::where('chat_id', $chatId) - ->orderBy('created_at', 'asc') + ->orderBy('opening_date', 'asc') ->with('user') ->get(); @@ -85,8 +85,8 @@ public function storeCapsule(Request $request, $chatId) { // Validation $request->validate([ - 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4|max:1048576', - 'message' => 'required|string', + 'file' => 'required|file|mimes:jpeg,png,jpg,gif,mp3,mp4,mov|max:1048576', + 'message' => 'required|string' ]); // Vérification de la présence du fichier @@ -104,6 +104,11 @@ public function storeCapsule(Request $request, $chatId) $message->message = $request->message; $message->media_url = $mediaName; + // Vérifier que la date d'ouverture est définie + if ($request->has('date_time')) { + $message->opening_date = $request->date_time; + } + $message->save(); return response()->json(['message' => $message]); diff --git a/resources/views/components/messaging/chatbar.blade.php b/resources/views/components/messaging/chatbar.blade.php index c934e1a..3b64ccb 100644 --- a/resources/views/components/messaging/chatbar.blade.php +++ b/resources/views/components/messaging/chatbar.blade.php @@ -22,7 +22,7 @@ class="rounded-full secondary-background-app p-2 flex items-center justify-cente

cliquez pour sélectionner un fichier

- +