sync identity from takahe on first fetch

This commit is contained in:
Her Email 2023-11-18 11:13:26 -05:00 committed by Henri Dickson
parent 67b1e5100e
commit fad290e91d
4 changed files with 14 additions and 25 deletions

@ -1 +1 @@
Subproject commit aecd500619beff9c848ff041fff6cfa54fe8211b
Subproject commit 4b434ff4a53d162e4caca0880d9827289ccac0f3

View file

@ -2,8 +2,8 @@ black~=22.12.0
coverage
django-debug-toolbar
django-stubs
djlint~=1.32.1
djlint~=1.34.0
isort~=5.12.0
lxml-stubs
pre-commit
pyright==1.1.333
pyright==1.1.336

View file

@ -108,24 +108,13 @@ def post_deleted(pk, obj):
Piece.objects.filter(posts__id=pk, local=False).delete()
def user_follow_updated(source_identity_pk, target_identity_pk):
u = Takahe.get_local_user_by_identity(source_identity_pk)
# Takahe.update_user_following(u)
logger.info(f"User {u} following updated")
def user_mute_updated(source_identity_pk, target_identity_pk):
u = Takahe.get_local_user_by_identity(source_identity_pk)
# Takahe.update_user_muting(u)
logger.info(f"User {u} muting updated")
def user_block_updated(source_identity_pk, target_identity_pk):
u = Takahe.get_local_user_by_identity(source_identity_pk)
if u:
# Takahe.update_user_rejecting(u)
logger.info(f"User {u} rejecting updated")
u = Takahe.get_local_user_by_identity(target_identity_pk)
if u:
# Takahe.update_user_rejecting(u)
logger.info(f"User {u} rejecting updated")
def identity_fetched(pk):
identity = Takahe.get_identity(pk)
if identity.username and identity.domain:
apid = Takahe.get_or_create_remote_apidentity(identity)
if apid:
logger.debug(f"Identity {identity} synced")
else:
logger.warning(f"Identity {identity} not synced")
else:
logger.warning(f"Identity {identity} has no username or domain")

View file

@ -361,7 +361,7 @@ class Identity(models.Model):
Represents both local and remote Fediverse identities (actors)
"""
domain_id: int
domain_id: str
class Restriction(models.IntegerChoices):
none = 0