mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Merge pull request #557 from matrix-org/dbkr/profile_dont_return_null
Omit keys rather then returning null in profile API
This commit is contained in:
commit
34dda7cc7f
@ -33,7 +33,11 @@ class ProfileDisplaynameRestServlet(ClientV1RestServlet):
|
|||||||
user,
|
user,
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {"displayname": displayname}))
|
ret = {}
|
||||||
|
if displayname is not None:
|
||||||
|
ret["displayname"] = displayname
|
||||||
|
|
||||||
|
defer.returnValue((200, ret))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_PUT(self, request, user_id):
|
def on_PUT(self, request, user_id):
|
||||||
@ -66,7 +70,11 @@ class ProfileAvatarURLRestServlet(ClientV1RestServlet):
|
|||||||
user,
|
user,
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {"avatar_url": avatar_url}))
|
ret = {}
|
||||||
|
if avatar_url is not None:
|
||||||
|
ret["avatar_url"] = avatar_url
|
||||||
|
|
||||||
|
defer.returnValue((200, ret))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def on_PUT(self, request, user_id):
|
def on_PUT(self, request, user_id):
|
||||||
@ -102,10 +110,13 @@ class ProfileRestServlet(ClientV1RestServlet):
|
|||||||
user,
|
user,
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {
|
ret = {}
|
||||||
"displayname": displayname,
|
if displayname is not None:
|
||||||
"avatar_url": avatar_url
|
ret["displayname"] = displayname
|
||||||
}))
|
if avatar_url is not None:
|
||||||
|
ret["avatar_url"] = avatar_url
|
||||||
|
|
||||||
|
defer.returnValue((200, ret))
|
||||||
|
|
||||||
|
|
||||||
def register_servlets(hs, http_server):
|
def register_servlets(hs, http_server):
|
||||||
|
Loading…
Reference in New Issue
Block a user