realm-emoji: Add realm emoji uploading instead url providing.

- Add file_name field to `RealmEmoji` model and migration.
- Add emoji upload supporting to Upload backends.
- Add uploaded file processing to emoji views.
- Use emoji source url as based for display url.
- Change emoji form for image uploading.
- Fix back-end tests.
- Fix front-end tests.
- Add tests for emoji uploading.

Fixes #1134
This commit is contained in:
K.Kanakhin
2017-03-13 10:45:50 +06:00
committed by Tim Abbott
parent 0785c377a4
commit f13d6a18eb
16 changed files with 418 additions and 54 deletions

View File

@@ -3095,9 +3095,9 @@ def notify_realm_emoji(realm):
realm_emoji=realm.get_emoji())
send_event(event, active_user_ids(realm))
def check_add_realm_emoji(realm, name, img_url, author=None):
def check_add_realm_emoji(realm, name, file_name, author=None):
# type: (Realm, Text, Text, Optional[UserProfile]) -> None
emoji = RealmEmoji(realm=realm, name=name, img_url=img_url, author=author)
emoji = RealmEmoji(realm=realm, name=name, file_name=file_name, author=author)
emoji.full_clean()
emoji.save()
notify_realm_emoji(realm)