mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-01 14:04:30 +02:00
Adapter attachment upload forms to the new system
This commit is contained in:
parent
0c33059c4e
commit
3585b8a56a
7 changed files with 32 additions and 22 deletions
|
@ -186,7 +186,7 @@ class AttachmentSubmitHandler
|
|||
*
|
||||
* @return Attachment The attachment with the new filename (same instance as passed $attachment)
|
||||
*/
|
||||
public function handleFormSubmit(Attachment $attachment, ?AttachmentUpload $upload): Attachment
|
||||
public function handleUpload(Attachment $attachment, ?AttachmentUpload $upload): Attachment
|
||||
{
|
||||
if ($upload === null) {
|
||||
$upload = $attachment->getUpload();
|
||||
|
@ -333,7 +333,7 @@ class AttachmentSubmitHandler
|
|||
*
|
||||
* @return Attachment The attachment with the new filepath
|
||||
*/
|
||||
protected function downloadURL(Attachment $attachment, array $secureAttachment): Attachment
|
||||
protected function downloadURL(Attachment $attachment, bool $secureAttachment): Attachment
|
||||
{
|
||||
//Check if we are allowed to download files
|
||||
if (!$this->allow_attachments_downloads) {
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace App\Services\UserSystem;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Attachments\AttachmentUpload;
|
||||
use App\Entity\Attachments\UserAttachment;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Services\Attachments\AttachmentSubmitHandler;
|
||||
|
@ -156,11 +157,10 @@ class UserAvatarHelper
|
|||
}
|
||||
|
||||
$attachment->setAttachmentType($attachment_type);
|
||||
//$user->setMasterPictureAttachment($attachment);
|
||||
}
|
||||
|
||||
//Handle the upload
|
||||
$this->submitHandler->handleFormSubmit($attachment, $file);
|
||||
$this->submitHandler->handleUpload($attachment, new AttachmentUpload(file: $file));
|
||||
|
||||
//Set attachment as master picture
|
||||
$user->setMasterPictureAttachment($attachment);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue