kopia lustrzana https://github.com/snarfed/bridgy-fed
User.get_or_create: cut down extra puts
rodzic
29482d1c66
commit
c47f3640e6
|
@ -268,13 +268,13 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
|
||||||
if ((old_val is None and new_val is not None)
|
if ((old_val is None and new_val is not None)
|
||||||
or (field == 'direct' and not old_val and new_val)):
|
or (field == 'direct' and not old_val and new_val)):
|
||||||
setattr(user, field, new_val)
|
setattr(user, field, new_val)
|
||||||
user.put()
|
|
||||||
|
|
||||||
if enabled_protocols := kwargs.get('enabled_protocols'):
|
if enabled_protocols := kwargs.get('enabled_protocols'):
|
||||||
user.enabled_protocols = (set(user.enabled_protocols)
|
user.enabled_protocols = (set(user.enabled_protocols)
|
||||||
| set(enabled_protocols))
|
| set(enabled_protocols))
|
||||||
|
|
||||||
if not propagate:
|
if not propagate:
|
||||||
|
user.put()
|
||||||
return user
|
return user
|
||||||
else:
|
else:
|
||||||
if orig := get_original(id):
|
if orig := get_original(id):
|
||||||
|
|
Ładowanie…
Reference in New Issue