Avoid unnecesary DB queries

This commit is contained in:
koalasat
2025-07-13 12:30:28 +02:00
parent a0b652d9e9
commit 2cf02cfb78

View File

@ -95,6 +95,8 @@ class RobotTokenSHA256AuthenticationMiddleWare:
nostr_pubkey = request.META.get("NOSTR_PUBKEY", "").replace(
"Nostr ", ""
)
if token.user.robot.nostr_pubkey != nostr_pubkey:
token.user.robot.nostr_pubkey = nostr_pubkey
token.user.robot.save(update_fields=["nostr_pubkey"])