-
-
Notifications
You must be signed in to change notification settings - Fork 770
Add indonesian translation & currency, add some refactoring #302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,7 +80,7 @@ public function upload(Request $request, $external_id) | |
| $totaltsize = substr($mbsize, 0, 4); | ||
|
|
||
| if ($totaltsize > 15) { | ||
| Session::flash('flash_message', __('File Size cannot be bigger than 15MB')); | ||
| session()->flash('flash_message', __('File Size cannot be bigger than 15MB')); | ||
| return redirect()->back(); | ||
|
Comment on lines
+83
to
84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incorrect flash key for error condition. File size limit exceeded is an error scenario, but 🔧 Suggested fix- session()->flash('flash_message', __('File Size cannot be bigger than 15MB'));
+ session()->flash('flash_message_warning', __('File Size cannot be bigger than 15MB'));Apply this change at lines 83, 133, and 183. Also applies to: 133-134, 183-184 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
@@ -102,7 +102,7 @@ public function upload(Request $request, $external_id) | |
| ] | ||
| ); | ||
| Document::create($input); | ||
| Session::flash('flash_message', __('File successfully uploaded')); | ||
| session()->flash('flash_message', __('File successfully uploaded')); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -130,7 +130,7 @@ public function uploadToTask(Request $request, $external_id) | |
| $totaltsize = substr($mbsize, 0, 4); | ||
|
|
||
| if ($totaltsize > 15) { | ||
| Session::flash('flash_message', __('File Size cannot be bigger than 15MB')); | ||
| session()->flash('flash_message', __('File Size cannot be bigger than 15MB')); | ||
| return redirect()->back(); | ||
| } | ||
|
|
||
|
|
@@ -151,7 +151,7 @@ public function uploadToTask(Request $request, $external_id) | |
| ]); | ||
| } | ||
| } | ||
| Session::flash('flash_message', __('File successfully uploaded')); | ||
| session()->flash('flash_message', __('File successfully uploaded')); | ||
| return $task->external_id; | ||
| } | ||
|
|
||
|
|
@@ -180,7 +180,7 @@ public function uploadToProject(Request $request, $external_id) | |
| $totaltsize = substr($mbsize, 0, 4); | ||
|
|
||
| if ($totaltsize > 15) { | ||
| Session::flash('flash_message', __('File Size cannot be bigger than 15MB')); | ||
| session()->flash('flash_message', __('File Size cannot be bigger than 15MB')); | ||
| return redirect()->back(); | ||
| } | ||
|
|
||
|
|
@@ -203,7 +203,7 @@ public function uploadToProject(Request $request, $external_id) | |
| ]); | ||
| } | ||
| } | ||
| Session::flash('flash_message', __('File successfully uploaded')); | ||
| session()->flash('flash_message', __('File successfully uploaded')); | ||
| return $project->external_id; | ||
| } | ||
|
|
||
|
|
@@ -219,9 +219,9 @@ public function destroy($external_id) | |
| $document = Document::whereExternalId($external_id)->first(); | ||
| $deleted = $fileSystem->delete($document); | ||
| if (!$deleted) { | ||
| Session()->flash('flash_message_warning', __("Something wen't wrong, we can't find the file on the cloud. But worry not, we delete what we know about the image")); | ||
| session()->flash('flash_message_warning', __("Something wen't wrong, we can't find the file on the cloud. But worry not, we delete what we know about the image")); | ||
| } else { | ||
| Session()->flash('flash_message', __('File has been deleted')); | ||
| session()->flash('flash_message', __('File has been deleted')); | ||
| } | ||
| $document->delete(); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreachable code after
throwstatement.Line 30 (
return redirect()->back();) will never execute because thethrowstatement on line 29 terminates execution. Additionally, flashing a session message before throwing an exception is ineffective since the flash data won't be available after the exception is handled.🐛 Proposed fix - either redirect or throw, not both
Option 1: Flash and redirect (user-friendly):
if (!array_key_exists($request->type, $modelsMapping)) { session()->flash('flash_message_warning', __('Could not create comment, type not found! Please contact Daybyday support')); - throw new \Exception("Could not create comment with type " . $request->type); return redirect()->back(); }Option 2: Just throw (for logging/debugging):
if (!array_key_exists($request->type, $modelsMapping)) { - session()->flash('flash_message_warning', __('Could not create comment, type not found! Please contact Daybyday support')); throw new \Exception("Could not create comment with type " . $request->type); - return redirect()->back(); }📝 Committable suggestion
🤖 Prompt for AI Agents