mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-20 20:04:19 -05:00
stop generating default identicons. reverts most of 582019f870
and solves vector-web/vector-im#346
This commit is contained in:
parent
10f82b4bea
commit
772ad4f715
@ -132,25 +132,9 @@ class RegistrationHandler(BaseHandler):
|
|||||||
raise RegistrationError(
|
raise RegistrationError(
|
||||||
500, "Cannot generate user ID.")
|
500, "Cannot generate user ID.")
|
||||||
|
|
||||||
# create a default avatar for the user
|
# We used to generate default identicons here, but nowadays
|
||||||
# XXX: ideally clients would explicitly specify one, but given they don't
|
# we want clients to generate their own as part of their branding
|
||||||
# and we want consistent and pretty identicons for random users, we'll
|
# rather than there being consistent matrix-wide ones, so we don't.
|
||||||
# do it here.
|
|
||||||
try:
|
|
||||||
auth_user = UserID.from_string(user_id)
|
|
||||||
media_repository = self.hs.get_resource_for_media_repository()
|
|
||||||
identicon_resource = media_repository.getChildWithDefault("identicon", None)
|
|
||||||
upload_resource = media_repository.getChildWithDefault("upload", None)
|
|
||||||
identicon_bytes = identicon_resource.generate_identicon(user_id, 320, 320)
|
|
||||||
content_uri = yield upload_resource.create_content(
|
|
||||||
"image/png", None, identicon_bytes, len(identicon_bytes), auth_user
|
|
||||||
)
|
|
||||||
profile_handler = self.hs.get_handlers().profile_handler
|
|
||||||
profile_handler.set_avatar_url(
|
|
||||||
auth_user, auth_user, ("%s#auto" % (content_uri,))
|
|
||||||
)
|
|
||||||
except NotImplementedError:
|
|
||||||
pass # make tests pass without messing around creating default avatars
|
|
||||||
|
|
||||||
defer.returnValue((user_id, token))
|
defer.returnValue((user_id, token))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user