Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync identity from takahe on first fetch #379

Merged
merged 1 commit into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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