mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 22:19:48 +00:00
emoji: Disable support for letting users switch emojisets.
Due to copyright issues with potentially displaying Apple emojisets on non-apple devices, as well as iamcal dropping support for the emojione emojiset (see https://github.com/iamcal/emoji-data/pull/142), we are dropping (perhaps temporarily) support for allowing users to switch emojisets in Zulip. This commit just hides the feature from the user but leaves most of the infrastructure in place so that in the future if we decide to re-enable the support we will not need to redo the infrastructure work (some JS-side code is deleted, mostly because we'll want to re-add the feature using the do_settings_change infrastructure anyway). The most likely emoji set to add is the legacy "blobs" Google emoji set, since it seems popular with some users. Tweaked by tabbott to remove some additional JS code and update the changelog.
This commit is contained in:
committed by
Tim Abbott
parent
1cfe7f6494
commit
9057e543ac
@@ -66,6 +66,9 @@ Zulip 1.9; it is generally updated in bursts.
|
|||||||
thousands of users and hundreds of bot users.
|
thousands of users and hundreds of bot users.
|
||||||
- Optimized production release tarballs to save about 40MB of size.
|
- Optimized production release tarballs to save about 40MB of size.
|
||||||
- Upgraded to the latest version of the Google emoji set.
|
- Upgraded to the latest version of the Google emoji set.
|
||||||
|
- Dropped, at least for now, support for user-configured alternative
|
||||||
|
emoji sets. This was largely motivated by
|
||||||
|
[EmojiOne requesting removal from the emoji-data project](https://github.com/iamcal/emoji-data/pull/142)
|
||||||
- Removed the "Delete streams" administration page; one can delete
|
- Removed the "Delete streams" administration page; one can delete
|
||||||
streams directly on "Manage streams".
|
streams directly on "Manage streams".
|
||||||
- Removed support code for the (long-deprecated) legacy desktop app.
|
- Removed support code for the (long-deprecated) legacy desktop app.
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ function setup_settings_label() {
|
|||||||
left_side_userlist: i18n.t("User list on left sidebar in narrow windows"),
|
left_side_userlist: i18n.t("User list on left sidebar in narrow windows"),
|
||||||
night_mode: i18n.t("Night mode"),
|
night_mode: i18n.t("Night mode"),
|
||||||
twenty_four_hour_time: i18n.t("24-hour time (17:00 instead of 5:00 PM)"),
|
twenty_four_hour_time: i18n.t("24-hour time (17:00 instead of 5:00 PM)"),
|
||||||
|
translate_emoji_to_text: i18n.t("Translate emoji to text (Convert 😃 to <code>:smile:</code>)"),
|
||||||
translate_emoticons: i18n.t("Translate emoticons (convert <code>:)</code> to 😃 in messages)"),
|
translate_emoticons: i18n.t("Translate emoticons (convert <code>:)</code> to 😃 in messages)"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ exports.set_up = function () {
|
|||||||
$("#display-settings-status").hide();
|
$("#display-settings-status").hide();
|
||||||
|
|
||||||
$("#user_timezone").val(page_params.timezone);
|
$("#user_timezone").val(page_params.timezone);
|
||||||
$(".emojiset_choice[value=" + page_params.emojiset + "]").prop("checked", true);
|
|
||||||
|
// $(".emojiset_choice[value=" + page_params.emojiset + "]").prop("checked", true);
|
||||||
|
$("#translate_emoji_to_text").prop('checked', page_params.emojiset === "text");
|
||||||
|
|
||||||
$("#default_language_modal [data-dismiss]").click(function () {
|
$("#default_language_modal [data-dismiss]").click(function () {
|
||||||
overlays.close_modal('default_language_modal');
|
overlays.close_modal('default_language_modal');
|
||||||
@@ -107,22 +109,15 @@ exports.set_up = function () {
|
|||||||
change_display_setting(data, '#time-settings-status');
|
change_display_setting(data, '#time-settings-status');
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".emojiset_choice").click(function () {
|
$("#translate_emoji_to_text").change(function () {
|
||||||
var emojiset = $(this).val();
|
|
||||||
var data = {};
|
var data = {};
|
||||||
data.emojiset = JSON.stringify(emojiset);
|
var is_checked = $("#translate_emoji_to_text").is(":checked");
|
||||||
var spinner = $("#emoji-settings-status").expectOne();
|
if (is_checked) {
|
||||||
loading.make_indicator(spinner, {text: settings_ui.strings.saving });
|
data.emojiset = JSON.stringify("text");
|
||||||
|
} else {
|
||||||
channel.patch({
|
data.emojiset = JSON.stringify("google");
|
||||||
url: '/json/settings/display',
|
}
|
||||||
data: data,
|
change_display_setting(data, '#emoji-settings-status');
|
||||||
success: function () {
|
|
||||||
},
|
|
||||||
error: function (xhr) {
|
|
||||||
ui_report.error(settings_ui.strings.failure, xhr, $('#emoji-settings-status').expectOne());
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#translate_emoticons").change(function () {
|
$("#translate_emoticons").change(function () {
|
||||||
@@ -134,25 +129,8 @@ exports.set_up = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.report_emojiset_change = function () {
|
exports.report_emojiset_change = function () {
|
||||||
// TODO: Clean up how this works so we can use
|
// This function still has full support for multiple emojiset options.
|
||||||
// change_display_setting. The challenge is that we don't want to
|
|
||||||
// report success before the server_events request returns that
|
|
||||||
// causes the actual sprite sheet to change. The current
|
|
||||||
// implementation is wrong, though, in that it displays the UI
|
|
||||||
// update in all active browser windows.
|
|
||||||
function emoji_success() {
|
|
||||||
if ($("#emoji-settings-status").length) {
|
|
||||||
loading.destroy_indicator($("#emojiset_spinner"));
|
|
||||||
$("#emojiset_select").val(page_params.emojiset);
|
|
||||||
ui_report.success(i18n.t("Emojiset changed successfully!"),
|
|
||||||
$('#emoji-settings-status').expectOne());
|
|
||||||
var spinner = $("#emoji-settings-status").expectOne();
|
|
||||||
settings_ui.display_checkmark(spinner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (page_params.emojiset === 'text') {
|
if (page_params.emojiset === 'text') {
|
||||||
emoji_success();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +138,6 @@ exports.report_emojiset_change = function () {
|
|||||||
sprite.onload = function () {
|
sprite.onload = function () {
|
||||||
var sprite_css_href = "/static/generated/emoji/" + page_params.emojiset + "_sprite.css";
|
var sprite_css_href = "/static/generated/emoji/" + page_params.emojiset + "_sprite.css";
|
||||||
$("#emoji-spritesheet").attr('href', sprite_css_href);
|
$("#emoji-spritesheet").attr('href', sprite_css_href);
|
||||||
emoji_success();
|
|
||||||
};
|
};
|
||||||
sprite.src = "/static/generated/emoji/sheet_" + page_params.emojiset + "_64.png";
|
sprite.src = "/static/generated/emoji/sheet_" + page_params.emojiset + "_64.png";
|
||||||
};
|
};
|
||||||
@@ -169,9 +146,9 @@ exports.update_page = function () {
|
|||||||
$("#twenty_four_hour_time").prop('checked', page_params.twenty_four_hour_time);
|
$("#twenty_four_hour_time").prop('checked', page_params.twenty_four_hour_time);
|
||||||
$("#left_side_userlist").prop('checked', page_params.left_side_userlist);
|
$("#left_side_userlist").prop('checked', page_params.left_side_userlist);
|
||||||
$("#default_language_name").text(page_params.default_language_name);
|
$("#default_language_name").text(page_params.default_language_name);
|
||||||
|
$("#translate_emoji_to_text").prop('checked', page_params.emojiset === "text");
|
||||||
$("#translate_emoticons").prop('checked', page_params.translate_emoticons);
|
$("#translate_emoticons").prop('checked', page_params.translate_emoticons);
|
||||||
$("#night_mode").prop('checked', page_params.night_mode);
|
$("#night_mode").prop('checked', page_params.night_mode);
|
||||||
// TODO: Set emojiset selector here.
|
|
||||||
// Longer term, we'll want to automate this function
|
// Longer term, we'll want to automate this function
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="user-emoji-settings">
|
<div id="user-emoji-settings">
|
||||||
<h3 class="inline-block light">Emoji style</h3>
|
<h3 class="inline-block light">Emoji settings</h3>
|
||||||
<div class="alert-notification" id="emoji-settings-status"></div>
|
<div class="alert-notification" id="emoji-settings-status"></div>
|
||||||
|
|
||||||
|
{{#if false}}
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="emojiset_choices grey-box">
|
<div class="emojiset_choices grey-box">
|
||||||
{{#each page_params.emojiset_choices }}
|
{{#each page_params.emojiset_choices }}
|
||||||
@@ -95,6 +96,12 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{partial "settings_checkbox"
|
||||||
|
"setting_name" "translate_emoji_to_text"
|
||||||
|
"is_checked" false
|
||||||
|
"label" settings_label.translate_emoji_to_text}}
|
||||||
|
|
||||||
{{partial "settings_checkbox"
|
{{partial "settings_checkbox"
|
||||||
"setting_name" "translate_emoticons"
|
"setting_name" "translate_emoticons"
|
||||||
|
|||||||
25
zerver/migrations/0181_userprofile_change_emojiset.py
Normal file
25
zerver/migrations/0181_userprofile_change_emojiset.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from django.db import migrations, models
|
||||||
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
||||||
|
from django.db.migrations.state import StateApps
|
||||||
|
|
||||||
|
def change_emojiset_choice(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
||||||
|
UserProfile = apps.get_model('zerver', 'UserProfile')
|
||||||
|
UserProfile.objects.exclude(emojiset__in=['google', 'text']).update(emojiset='google')
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('zerver', '0180_usermessage_add_active_mobile_push_notification'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(
|
||||||
|
change_emojiset_choice,
|
||||||
|
reverse_code=migrations.RunPython.noop),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='userprofile',
|
||||||
|
name='emojiset',
|
||||||
|
field=models.CharField(choices=[('google', 'Google'), ('text', 'Plain text')], default='google', max_length=20),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -771,15 +771,9 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||||||
timezone = models.CharField(max_length=40, default=u'') # type: str
|
timezone = models.CharField(max_length=40, default=u'') # type: str
|
||||||
|
|
||||||
# Emojisets
|
# Emojisets
|
||||||
APPLE_EMOJISET = u'apple'
|
|
||||||
EMOJIONE_EMOJISET = u'emojione'
|
|
||||||
GOOGLE_EMOJISET = u'google'
|
GOOGLE_EMOJISET = u'google'
|
||||||
TWITTER_EMOJISET = u'twitter'
|
|
||||||
TEXT_EMOJISET = u'text'
|
TEXT_EMOJISET = u'text'
|
||||||
EMOJISET_CHOICES = ((GOOGLE_EMOJISET, "Google"),
|
EMOJISET_CHOICES = ((GOOGLE_EMOJISET, "Google"),
|
||||||
(APPLE_EMOJISET, "Apple"),
|
|
||||||
(TWITTER_EMOJISET, "Twitter"),
|
|
||||||
(EMOJIONE_EMOJISET, "EmojiOne"),
|
|
||||||
(TEXT_EMOJISET, "Plain text"))
|
(TEXT_EMOJISET, "Plain text"))
|
||||||
emojiset = models.CharField(default=GOOGLE_EMOJISET, choices=EMOJISET_CHOICES, max_length=20) # type: str
|
emojiset = models.CharField(default=GOOGLE_EMOJISET, choices=EMOJISET_CHOICES, max_length=20) # type: str
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class ChangeSettingsTest(ZulipTestCase):
|
|||||||
|
|
||||||
test_changes = dict(
|
test_changes = dict(
|
||||||
default_language = 'de',
|
default_language = 'de',
|
||||||
emojiset = 'apple',
|
emojiset = 'google',
|
||||||
timezone = 'US/Mountain',
|
timezone = 'US/Mountain',
|
||||||
) # type: Dict[str, Any]
|
) # type: Dict[str, Any]
|
||||||
|
|
||||||
@@ -260,6 +260,26 @@ class ChangeSettingsTest(ZulipTestCase):
|
|||||||
for setting in user_settings:
|
for setting in user_settings:
|
||||||
self.do_test_change_user_display_setting(setting)
|
self.do_test_change_user_display_setting(setting)
|
||||||
|
|
||||||
|
def do_change_emojiset(self, emojiset: str) -> HttpResponse:
|
||||||
|
email = self.example_email('hamlet')
|
||||||
|
self.login(email)
|
||||||
|
data = {'emojiset': ujson.dumps(emojiset)}
|
||||||
|
result = self.client_patch("/json/settings/display", data)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def test_emojiset(self) -> None:
|
||||||
|
"""Test banned emojisets are not accepted."""
|
||||||
|
banned_emojisets = ['apple', 'emojione', 'twitter']
|
||||||
|
valid_emojisets = ['google', 'text']
|
||||||
|
|
||||||
|
for emojiset in banned_emojisets:
|
||||||
|
result = self.do_change_emojiset(emojiset)
|
||||||
|
self.assert_json_error(result, "Invalid emojiset '%s'" % (emojiset))
|
||||||
|
|
||||||
|
for emojiset in valid_emojisets:
|
||||||
|
result = self.do_change_emojiset(emojiset)
|
||||||
|
self.assert_json_success(result)
|
||||||
|
|
||||||
|
|
||||||
class UserChangesTest(ZulipTestCase):
|
class UserChangesTest(ZulipTestCase):
|
||||||
def test_update_api_key(self) -> None:
|
def test_update_api_key(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user