mirror of https://github.com/zulip/zulip.git
parent
d598fae52e
commit
59d22e7cb8
|
@ -373,7 +373,6 @@ def build_custom_checkers(by_lang):
|
|||
('zerver/views/streams.py', 'return json_error(property_conversion)'),
|
||||
('zerver/views/streams.py', 'return json_error(e.error, data=result, status=404)'),
|
||||
# We can't do anything about this.
|
||||
('zerver/views/realm_emoji.py', 'return json_error(e.messages[0])'),
|
||||
('zerver/views/realm_filters.py', 'return json_error(e.messages[0], data={"errors": dict(e)})'),
|
||||
]),
|
||||
'description': 'Argument to json_error should a literal string enclosed by _()'},
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import ugettext as _
|
||||
from typing import Text
|
||||
|
||||
from zerver.models import UserProfile
|
||||
from zerver.lib.emoji import check_emoji_admin, check_valid_emoji_name, check_valid_emoji
|
||||
from zerver.lib.request import JsonableError, REQ, has_request_variables
|
||||
from zerver.lib.response import json_success, json_error
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.actions import check_add_realm_emoji, do_remove_realm_emoji
|
||||
|
||||
def list_emoji(request, user_profile):
|
||||
|
@ -23,10 +22,7 @@ def upload_emoji(request, user_profile, emoji_name=None, url=REQ()):
|
|||
# type: (HttpRequest, UserProfile, Text, Text) -> HttpResponse
|
||||
check_valid_emoji_name(emoji_name)
|
||||
check_emoji_admin(user_profile)
|
||||
try:
|
||||
check_add_realm_emoji(user_profile.realm, emoji_name, url, author=user_profile)
|
||||
except ValidationError as e:
|
||||
return json_error(e.messages[0])
|
||||
return json_success()
|
||||
|
||||
def delete_emoji(request, user_profile, emoji_name):
|
||||
|
|
Loading…
Reference in New Issue