mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 13:52:50 +08:00
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:
parent
0843e3e6ce
commit
53529a3427
2
Gemfile
2
Gemfile
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{combo-box
|
||||
elementId=field.id
|
||||
id=field.id
|
||||
class=fieldClass
|
||||
value=field.value
|
||||
content=field.choices
|
||||
|
|
|
@ -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"}}
|
||||
|
|
|
@ -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"}}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user