diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a98080..d4c665b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. +## v1.2.3 - (2021-06-19) + +### Fixed + +- XSS issue on inputs. +- UI/UX fixes & improvements. +- Send message fixes (UI & backend). +- Update Profile Settings (upload file & error handling ….). +- Shared photos not working issue. +- Typo error fixes (Your `contatc` list is empty). +- Rolling back migrations added. +- Get Last message `orderBy` query duplication. + ## v1.2.2 - (2021-06-01) ### Fixed diff --git a/src/Http/Controllers/MessagesController.php b/src/Http/Controllers/MessagesController.php index 2009ba5..7083216 100644 --- a/src/Http/Controllers/MessagesController.php +++ b/src/Http/Controllers/MessagesController.php @@ -116,7 +116,12 @@ public function download($fileName) public function send(Request $request) { // default variables - $error_msg = $attachment = $attachment_title = null; + $error = (object)[ + 'status' => 0, + 'message' => null + ]; + $attachment = null; + $attachment_title = null; // if there is attachment [file] if ($request->hasFile('file')) { @@ -135,14 +140,16 @@ public function send(Request $request) $attachment = Str::uuid() . "." . $file->getClientOriginalExtension(); $file->storeAs("public/" . config('chatify.attachments.folder'), $attachment); } else { - $error_msg = "File extension not allowed!"; + $error->status = 1; + $error->message = "File extension not allowed!"; } } else { - $error_msg = "File size is too long!"; + $error->status = 1; + $error->message = "File extension not allowed!"; } } - if (!$error_msg) { + if (!$error->status) { // send to database $messageID = mt_rand(9, 999999999) + time(); Chatify::newMessage([ @@ -171,8 +178,7 @@ public function send(Request $request) // send the response return Response::json([ 'status' => '200', - 'error' => $error_msg ? 1 : 0, - 'error_msg' => $error_msg, + 'error' => $error, 'message' => Chatify::messageCard(@$messageData), 'tempID' => $request['temporaryMsgId'], ]);