mirror of https://github.com/zulip/zulip.git
realm_logo: Update `upload_logo` views to return nothing.
This commit is contained in:
parent
276020445d
commit
095e24c515
|
@ -1323,12 +1323,6 @@ class RealmLogoTest(UploadSerializeMixin, ZulipTestCase):
|
|||
A PUT request to /json/realm/logo with a valid file should return a url
|
||||
and actually create an realm logo.
|
||||
"""
|
||||
if self.night:
|
||||
field_name = 'night_logo_url'
|
||||
file_name = 'night_logo.png'
|
||||
else:
|
||||
field_name = 'logo_url'
|
||||
file_name = 'logo.png'
|
||||
for fname, rfname in self.correct_files:
|
||||
# TODO: use self.subTest once we're exclusively on python 3 by uncommenting the line below.
|
||||
# with self.subTest(fname=fname):
|
||||
|
@ -1337,13 +1331,10 @@ class RealmLogoTest(UploadSerializeMixin, ZulipTestCase):
|
|||
result = self.client_post("/json/realm/logo", {'file': fp, 'night': ujson.dumps(self.night)})
|
||||
realm = get_realm('zulip')
|
||||
self.assert_json_success(result)
|
||||
self.assertIn(field_name, result.json())
|
||||
base = '/user_avatars/%s/realm/%s' % (realm.id, file_name)
|
||||
url = result.json()[field_name]
|
||||
self.assertEqual(base, url[:len(base)])
|
||||
logo_url = realm_logo_url(realm, self.night)
|
||||
|
||||
if rfname is not None:
|
||||
response = self.client_get(url)
|
||||
response = self.client_get(logo_url)
|
||||
data = b"".join(response.streaming_content)
|
||||
# size should be 100 x 100 because thumbnail keeps aspect ratio
|
||||
# while trying to fit in a 800 x 100 box without losing part of the image
|
||||
|
|
|
@ -28,16 +28,7 @@ def upload_logo(request: HttpRequest, user_profile: UserProfile,
|
|||
settings.MAX_LOGO_FILE_SIZE))
|
||||
upload_logo_image(logo_file, user_profile, night)
|
||||
do_change_logo_source(user_profile.realm, user_profile.realm.LOGO_UPLOADED, night)
|
||||
logo_url = realm_logo_url(user_profile.realm, night)
|
||||
if night:
|
||||
json_result = dict(
|
||||
night_logo_url=logo_url
|
||||
)
|
||||
else:
|
||||
json_result = dict(
|
||||
logo_url=logo_url
|
||||
)
|
||||
return json_success(json_result)
|
||||
return json_success()
|
||||
|
||||
@require_realm_admin
|
||||
@has_request_variables
|
||||
|
|
Loading…
Reference in New Issue