Merge pull request #2777 from paperless-ngx/bugfix-owner-on-new-document

Don't submit owner via API on document upload
This commit is contained in:
Jonas Winkler 2023-03-01 01:08:54 +01:00 committed by GitHub
commit 020abaf7d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 17 deletions

View File

@ -28,7 +28,6 @@ export class UploadDocumentsService {
fileEntry.file((file: File) => {
let formData = new FormData()
formData.append('document', file, file.name)
formData.set('owner', this.settings.currentUser.id.toString())
let status = this.consumerStatusService.newFileUpload(file.name)
status.message = $localize`Connecting...`

View File

@ -683,14 +683,6 @@ class PostDocumentSerializer(serializers.Serializer):
required=False,
)
owner = serializers.PrimaryKeyRelatedField(
queryset=User.objects.all(),
label="Owner",
allow_null=True,
write_only=True,
required=False,
)
archive_serial_number = serializers.IntegerField(
label="ASN",
write_only=True,
@ -728,12 +720,6 @@ class PostDocumentSerializer(serializers.Serializer):
else:
return None
def validate_owner(self, owner):
if owner:
return owner.id
else:
return None
class BulkDownloadSerializer(DocumentListSerializer):

View File

@ -672,7 +672,6 @@ class PostDocumentView(GenericAPIView):
tag_ids = serializer.validated_data.get("tags")
title = serializer.validated_data.get("title")
created = serializer.validated_data.get("created")
owner_id = serializer.validated_data.get("owner")
archive_serial_number = serializer.validated_data.get("archive_serial_number")
t = int(mktime(datetime.now().timetuple()))
@ -698,7 +697,7 @@ class PostDocumentView(GenericAPIView):
override_tag_ids=tag_ids,
task_id=task_id,
override_created=created,
override_owner_id=owner_id,
override_owner_id=request.user.id,
override_archive_serial_num=archive_serial_number,
)