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,9 +95,11 @@ class RobotTokenSHA256AuthenticationMiddleWare:
nostr_pubkey = request.META.get("NOSTR_PUBKEY", "").replace(
"Nostr ", ""
)
token.user.robot.nostr_pubkey = nostr_pubkey
token.user.robot.save(update_fields=["nostr_pubkey"])
if token.user.robot.nostr_pubkey != nostr_pubkey:
token.user.robot.nostr_pubkey = nostr_pubkey
token.user.robot.save(update_fields=["nostr_pubkey"])
# END deprecate after v0.8.0
except Exception: