refactoring

This commit is contained in:
Čarodej
2021-11-26 07:48:38 +01:00
parent 64e8bccb31
commit 5626a054da
6 changed files with 27 additions and 17 deletions
+2 -2
View File
@@ -501,8 +501,8 @@ return [
'popup_deleted_user_aborted.title' => "User wasn't deleted",
'popup_error.message' => "Something went wrong and we can't continue. Please contact us.",
'popup_error.title' => 'Whooops, something went wrong!',
'popup_exceed_limit.message' => 'Please contact your administrator to change your limit.',
'popup_exceed_limit.title' => 'Whooops, you exceed storage limit :(',
'popup_exceed_limit.message' => 'Please upgrade your account to change your limit.',
'popup_exceed_limit.title' => 'You exceed storage limit',
'popup_mimetypes_blacklist.message' => 'File of this type ({mimetype}) is not allowed to upload.',
'popup_mimetypes_blacklist.title' => 'You are trying to upload unsupported file type',
'popup_move_item.cancel' => 'Cancel',
+15 -1
View File
@@ -545,5 +545,19 @@
"/js/main.7fcce007a830181b8076.hot-update.js": "/js/main.7fcce007a830181b8076.hot-update.js",
"/chunks/invoices.0fc3648804617ab3f456.hot-update.js": "/chunks/invoices.0fc3648804617ab3f456.hot-update.js",
"/chunks/invoices.3c88509d82835e292a67.hot-update.js": "/chunks/invoices.3c88509d82835e292a67.hot-update.js",
"/chunks/invoices.705b43cc74409c2e5b8f.hot-update.js": "/chunks/invoices.705b43cc74409c2e5b8f.hot-update.js"
"/chunks/invoices.705b43cc74409c2e5b8f.hot-update.js": "/chunks/invoices.705b43cc74409c2e5b8f.hot-update.js",
"/js/main.b95f73bb148600d91b55.hot-update.js": "/js/main.b95f73bb148600d91b55.hot-update.js",
"/js/main.ca8d78ccf4aabe01eb0b.hot-update.js": "/js/main.ca8d78ccf4aabe01eb0b.hot-update.js",
"/js/main.1916a7395ff464335236.hot-update.js": "/js/main.1916a7395ff464335236.hot-update.js",
"/js/main.6f2ae936594ea5cc2014.hot-update.js": "/js/main.6f2ae936594ea5cc2014.hot-update.js",
"/js/main.304c91d0372502435a0b.hot-update.js": "/js/main.304c91d0372502435a0b.hot-update.js",
"/js/main.71254a37385ec1585431.hot-update.js": "/js/main.71254a37385ec1585431.hot-update.js",
"/js/main.f2c3546dec7a674525ff.hot-update.js": "/js/main.f2c3546dec7a674525ff.hot-update.js",
"/js/main.d5524d4a0e6fd0f29b85.hot-update.js": "/js/main.d5524d4a0e6fd0f29b85.hot-update.js",
"/js/main.a1f0eebf13ea1c14bfc5.hot-update.js": "/js/main.a1f0eebf13ea1c14bfc5.hot-update.js",
"/js/main.bc54f89fe669868b1cc3.hot-update.js": "/js/main.bc54f89fe669868b1cc3.hot-update.js",
"/js/main.c85b0e6c1c407b517efa.hot-update.js": "/js/main.c85b0e6c1c407b517efa.hot-update.js",
"/js/main.6d054575b90412bd027d.hot-update.js": "/js/main.6d054575b90412bd027d.hot-update.js",
"/js/main.1b9dd6c7b70765387854.hot-update.js": "/js/main.1b9dd6c7b70765387854.hot-update.js",
"/js/main.1be136e3d8e2c392d8aa.hot-update.js": "/js/main.1be136e3d8e2c392d8aa.hot-update.js"
}
+5 -4
View File
@@ -236,18 +236,19 @@ const FunctionHelpers = {
totalUploadedSize: uploadedSize
}).then(() => {
uploadedSize = uploadedSize + chunk.size
}).catch((error) => {
}).catch(error => {
// Count attempts
attempts++
// Show Error
if (attempts === 3)
this.$isSomethingWrong()
//if (attempts === 3)
// Break uploading process
if ([500, 422].includes(error.response.status))
if ([500, 422].includes(error.response.status)) {
isNotGeneralError = false
this.$isSomethingWrong()
}
})
} while (isNotGeneralError && attempts !== 0 && attempts !== 3)
-3
View File
@@ -225,9 +225,6 @@ const actions = {
}
}
console.log(error.response);
console.log(error.response.status);
events.$emit('alert:open', {
emoji: '😬😬😬',
title: messages[error.response.status]['title'],
+4 -2
View File
@@ -3,6 +3,7 @@
namespace App\Users\Models;
use ByteUnits\Metric;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Domain\Files\Models\File;
use Domain\Folders\Models\Folder;
@@ -141,8 +142,9 @@ class User extends Authenticatable implements MustVerifyEmail
*/
public function getUsedCapacityAttribute(): int
{
return $this->filesWithTrashed
->map(fn($item) => $item->getRawOriginal())->sum('filesize');
return DB::table('files')
->where('user_id', $this->id)
->sum('filesize');
}
/**
+1 -5
View File
@@ -484,12 +484,8 @@ if (! function_exists('get_storage_fill_percentage')) {
if (! function_exists('user_storage_percentage')) {
/**
* Get user capacity fill by percentage
*
* @param $id
* @param null $additionals
* @return string
*/
function user_storage_percentage($id, $additionals = null)
function user_storage_percentage($id, int $additionals = null)
{
$user = User::findOrFail($id);