You've already forked snikket-web-portal
Make AdminUserInfo compatible with new API
The mod_http_admin_api changed recently [1], so we need to follow suit. Fixes #149. [1]: https://hg.prosody.im/prosody-modules/rev/d68348323406
This commit is contained in:
@@ -61,12 +61,18 @@ class AdminUserInfo:
|
||||
cls,
|
||||
data: typing.Mapping[str, typing.Any],
|
||||
) -> "AdminUserInfo":
|
||||
try:
|
||||
roles: typing.Optional[typing.List[str]] = [data["role"]]
|
||||
assert roles is not None # make mypy happy
|
||||
roles.extend(data.get("secondary_roles", []))
|
||||
except KeyError:
|
||||
roles = data.get("roles")
|
||||
return cls(
|
||||
localpart=data["username"],
|
||||
display_name=data.get("display_name") or None,
|
||||
email=data.get("email") or None,
|
||||
phone=data.get("phone") or None,
|
||||
roles=data.get("roles"),
|
||||
roles=roles,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user