Skip to content

Commit

Permalink
sync identity from takahe on first fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
Her Email authored and alphatownsman committed Nov 18, 2023
1 parent 67b1e51 commit fad290e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 10 additions & 21 deletions takahe/ap_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
2 changes: 1 addition & 1 deletion takahe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fad290e

Please sign in to comment.