You've already forked hotpocket
BTHLABS-94: Pass is_netloc_banned from save to share extension
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user