BTHLABS-94: Pass is_netloc_banned from save to share extension

This commit is contained in:
2026-07-21 08:20:43 +02:00
parent 9565a71bc8
commit d90504eed9
15 changed files with 124 additions and 34 deletions

View File

@@ -10,10 +10,12 @@ class SavesCreateOut(pydantic.BaseModel):
id: uuid.UUID
target_uuid: uuid.UUID
url: pydantic.AnyHttpUrl
is_netloc_banned: bool
def to_rpc(self) -> dict:
return {
'id': self.id,
'target_uuid': self.target_uuid,
'url': str(self.url),
'is_netloc_banned': self.is_netloc_banned,
}

View File

@@ -25,6 +25,7 @@ def create(request: HttpRequest, url: str) -> SavesCreateOut:
'url': request.build_absolute_uri(reverse(
'ui.associations.view', args=(association.pk,),
)),
'is_netloc_banned': association.target.is_netloc_banned,
})
return result

View File

@@ -9,7 +9,10 @@ from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from hotpocket_backend.apps.accounts.types import PAccount
from hotpocket_soa.dto.associations import AssociationOut
from hotpocket_soa.dto.associations import (
AssociationOut,
AssociationWithTargetOut,
)
from hotpocket_soa.dto.celery import AsyncResultOut
from hotpocket_soa.dto.saves import SaveIn, SaveOut
@@ -69,9 +72,14 @@ class CreateSaveWorkflow(SaveWorkflow):
request: HttpRequest,
account: PAccount,
url: str,
) -> AssociationOut:
) -> AssociationWithTargetOut:
save, association, processing_result = self.create_associate_and_process(
account, url,
)
return association
result = AssociationWithTargetOut.from_association_save(
association=association,
save=save,
)
return result