Skip to content

Commit 9853335

Browse files
committed
chore: simplify the orm part
1 parent 10daf51 commit 9853335

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

components/renku_data_services/activitypub/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ async def _discover_inbox_url(self, actor_uri: str) -> Optional[str]:
501501
return None
502502

503503
logger.info(f"Discovered inbox URL: {inbox_url}")
504-
return inbox_url
504+
# Ensure we're returning a string, not Any
505+
return str(inbox_url) if inbox_url else None
505506

506507
except Exception as e:
507508
logger.exception(f"Error discovering inbox URL: {e}")

components/renku_data_services/activitypub/db.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,14 @@ async def add_follower(
259259

260260
# Create the follower using the ORM
261261
logger.info(f"Creating new follower record for {follower.follower_actor_uri}")
262+
262263
follower_orm = orm.ActivityPubFollowerORM(
263-
actor_id=actor_orm.id,
264+
actor_id=follower.actor_id,
264265
follower_actor_uri=follower.follower_actor_uri,
265266
accepted=follower.accepted,
266267
actor=actor_orm
267268
)
268269

269-
await session.refresh(actor_orm)
270270
session.add(follower_orm)
271271
await session.flush()
272272
await session.refresh(follower_orm)

components/renku_data_services/activitypub/orm.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ class ActivityPubActorORM(BaseORM):
5555

5656
# Relationships
5757
followers: Mapped[list["ActivityPubFollowerORM"]] = relationship(
58-
"ActivityPubFollowerORM",
5958
primaryjoin="ActivityPubActorORM.id == ActivityPubFollowerORM.actor_id",
6059
back_populates="actor",
6160
cascade="all, delete-orphan",
6261
lazy="selectin",
63-
repr=False,
6462
default_factory=list,
6563
)
6664

@@ -107,11 +105,9 @@ class ActivityPubFollowerORM(BaseORM):
107105

108106
# Relationships
109107
actor: Mapped[ActivityPubActorORM] = relationship(
110-
ActivityPubActorORM,
111108
primaryjoin="ActivityPubActorORM.id == ActivityPubFollowerORM.actor_id",
112109
back_populates="followers",
113110
lazy="selectin",
114-
repr=False,
115111
default=None,
116112
)
117113

0 commit comments

Comments
 (0)