DEV: Upgrade Ember to version 3.12.2 (#8753)

* DEV: Use Ember 3.12.2
* Add Ember version to ThemeField's DEPENDENT_CONSTANTS
* DEV: Use `id` instead of `elementId` (See: https://github.com/emberjs/ember.js/issues/18147)
* FIX: Don't leak event listeners (bug introduced in 999e2ff)
This commit is contained in:
Jarek Radosz 2020-02-05 14:51:00 +01:00 committed by GitHub
parent 0843e3e6ce
commit 53529a3427
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 20 deletions

View File

@ -65,7 +65,7 @@ gem 'http_accept_language', require: false
# Ember related gems need to be pinned cause they control client side
# behavior, we will push these versions up when upgrading ember
gem 'ember-rails', '0.18.5'
gem 'discourse-ember-source', '~> 3.10.0'
gem 'discourse-ember-source', '~> 3.12.2'
gem 'ember-handlebars-template', '0.8.0'
gem 'barber'

View File

@ -98,7 +98,7 @@ GEM
debug_inspector (0.0.3)
diff-lcs (1.3)
diffy (3.3.0)
discourse-ember-source (3.10.0.2)
discourse-ember-source (3.12.2.0)
discourse_image_optim (0.26.2)
exifr (~> 1.2, >= 1.2.2)
fspath (~> 3.0)
@ -455,7 +455,7 @@ DEPENDENCIES
cppjieba_rb
css_parser
diffy
discourse-ember-source (~> 3.10.0)
discourse-ember-source (~> 3.12.2)
discourse_image_optim
email_reply_trimmer
ember-handlebars-template (= 0.8.0)

View File

@ -111,6 +111,8 @@ export default MountWidget.extend(Docking, {
},
willDestroyElement() {
this._super(...arguments);
if (!this.site.mobileView) {
this.appEvents.off("composer:opened", this, this.queueRerender);
this.appEvents.off("composer:resized", this, this.queueRerender);

View File

@ -126,8 +126,6 @@ export function performEmojiUnescape(string, opts) {
} alt='${emojiVal}' class='${classes}'>`
: m;
});
return string;
}
export function performEmojiEscape(string, opts) {
@ -145,8 +143,6 @@ export function performEmojiEscape(string, opts) {
return m;
});
return string;
}
export function isCustomEmoji(code, opts) {

View File

@ -1,5 +1,5 @@
{{combo-box
elementId=field.id
id=field.id
class=fieldClass
value=field.value
content=field.choices

View File

@ -1 +1 @@
{{input elementId=field.id value=field.value class=fieldClass placeholder=field.placeholder tabindex="9"}}
{{input id=field.id value=field.value class=fieldClass placeholder=field.placeholder tabindex="9"}}

View File

@ -1 +1 @@
{{textarea elementId=field.id value=field.value class=fieldClass placeholder=field.placeholder tabindex="9"}}
{{textarea id=field.id value=field.value class=fieldClass placeholder=field.placeholder tabindex="9"}}

View File

@ -61,8 +61,11 @@ class ThemeField < ActiveRecord::Base
if: Proc.new { |field| ThemeField.theme_var_type_ids.include?(field.type_id) }
BASE_COMPILER_VERSION = 14
DEPENDENT_CONSTANTS = [BASE_COMPILER_VERSION,
GlobalSetting.cdn_url]
DEPENDENT_CONSTANTS = [
BASE_COMPILER_VERSION,
Ember::VERSION,
GlobalSetting.cdn_url
]
COMPILER_VERSION = Digest::SHA1.hexdigest(DEPENDENT_CONSTANTS.join)
belongs_to :theme

View File

@ -74,6 +74,11 @@ describe ThemeJavascriptCompiler do
# For the Ember (Glimmer) templates, serverside rendering is not trivial,
# so check the compiled JSON against known working output
let(:compiler) { described_class.new(theme_id) }
let(:helper_opcode) do
append = statement("{{dummy-helper 1}}")[0]
helper = append[1]
helper[0]
end
def statement(template)
compiled = compiler.compile(template)
@ -82,28 +87,26 @@ describe ThemeJavascriptCompiler do
block["statements"]
end
# might change/break when updating ember
EMBER_INTERNAL_ID = 29
it 'adds the theme id to the helpers' do
expect(statement("{{theme-prefix 'translation_key'}}")).
to eq([[1, [EMBER_INTERNAL_ID, "theme-prefix", [22, "translation_key"], nil], false]])
to eq([[1, [helper_opcode, "theme-prefix", [22, "translation_key"], nil], false]])
expect(statement("{{theme-i18n 'translation_key'}}")).
to eq([[1, [EMBER_INTERNAL_ID, "theme-i18n", [22, "translation_key"], nil], false]])
to eq([[1, [helper_opcode, "theme-i18n", [22, "translation_key"], nil], false]])
expect(statement("{{theme-setting 'setting_key'}}")).
to eq([[1, [EMBER_INTERNAL_ID, "theme-setting", [22, "setting_key"], nil], false]])
to eq([[1, [helper_opcode, "theme-setting", [22, "setting_key"], nil], false]])
# Works when used inside other statements
expect(statement("{{dummy-helper (theme-prefix 'translation_key')}}")).
to eq([[1, [EMBER_INTERNAL_ID, "dummy-helper", [[EMBER_INTERNAL_ID, "theme-prefix", [22, "translation_key"], nil]], nil], false]])
to eq([[1, [helper_opcode, "dummy-helper", [[helper_opcode, "theme-prefix", [22, "translation_key"], nil]], nil], false]])
end
it 'works with the old settings syntax' do
expect(statement("{{themeSettings.setting_key}}")).
to eq([[1, [EMBER_INTERNAL_ID, "theme-setting", [22, "setting_key"], [["deprecated"], [true]]], false]])
to eq([[1, [helper_opcode, "theme-setting", [22, "setting_key"], [["deprecated"], [true]]], false]])
# Works when used inside other statements
expect(statement("{{dummy-helper themeSettings.setting_key}}")).
to eq([[1, [EMBER_INTERNAL_ID, "dummy-helper", [[EMBER_INTERNAL_ID, "theme-setting", [22, "setting_key"], [["deprecated"], [true]]]], nil], false]])
to eq([[1, [helper_opcode, "dummy-helper", [[helper_opcode, "theme-setting", [22, "setting_key"], [["deprecated"], [true]]]], nil], false]])
end
end