mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: remove trivial {{action}} usages (#24278)
This removes all trivial usages of the `{{action}}` keyword (the helper form, not the modifier form), where trivial means:
1. It's a co-located component (`.hbs` next to `.js`)
2. The JS file has a default export that is native class
3. `{{action "foo"}}` or `(action "foo")` with no extra arguments
4. There is a corresponding `foo()` method defined on the class (not inherited, etc)
There are more usages that is slightly more involved (with arguments, etc) that we can deal with, but this PR seems big enough so I just included the easiest cases here.
To aid review, each file is converted in an individual commit, and the matching method is temporary annotated with `@__action__` instead of the normal `@action`. This forces a git diff when it is already annotated as `@action`.
* DEV: {{action}} -> @action admin-penalty-post-action.hbs
* DEV: {{action}} -> @action admin-report.hbs
* DEV: {{action}} -> @action admin-watched-word.hbs
* DEV: {{action}} -> @action emoji-value-list.hbs
* DEV: {{action}} -> @action bool.hbs
* DEV: {{action}} -> @action category.hbs
* DEV: {{action}} -> @action secret-value-list.hbs
* DEV: {{action}} -> @action category-list.hbs
* DEV: {{action}} -> @action color.hbs
* DEV: {{action}} -> @action compact-list.hbs
* DEV: {{action}} -> @action group-list.hbs
* DEV: {{action}} -> @action host-list.hbs
* DEV: {{action}} -> @action named-list.hbs
* DEV: {{action}} -> @action simple-list.hbs
* DEV: {{action}} -> @action tag-group-list.hbs
* DEV: {{action}} -> @action tag-list.hbs
* DEV: {{action}} -> @action value-list.hbs
* DEV: {{action}} -> @action watched-word-form.hbs
* DEV: {{action}} -> @action composer-messages.hbs
* DEV: {{action}} -> @action section.hbs
* DEV: {{action}} -> @action user-status-picker.hbs
* DEV: cleanup @__action__ -> @action
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<ComboBox
|
||||
@value={{this.postAction}}
|
||||
@content={{this.penaltyActions}}
|
||||
@onChange={{action "penaltyChanged"}}
|
||||
@onChange={{this.penaltyChanged}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<DateTimeInputRange
|
||||
@from={{this.startDate}}
|
||||
@to={{this.endDate}}
|
||||
@onChange={{action "onChangeDateRange"}}
|
||||
@onChange={{this.onChangeDateRange}}
|
||||
@showFromTime={{false}}
|
||||
@showToTime={{false}}
|
||||
/>
|
||||
@@ -205,7 +205,7 @@
|
||||
(concat "report-filters/" filter.type)
|
||||
model=this.model
|
||||
filter=filter
|
||||
applyFilter=(action "applyFilter")
|
||||
applyFilter=this.applyFilter
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<span
|
||||
role="button"
|
||||
onclick={{action "deleteWord"}}
|
||||
onclick={{this.deleteWord}}
|
||||
class="delete-word-record"
|
||||
>{{d-icon "times"}}</span>
|
||||
{{this.word.word}}
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
<EmojiPicker
|
||||
@isActive={{this.emojiPickerIsActive}}
|
||||
@isEditorFocused={{this.isEditorFocused}}
|
||||
@emojiSelected={{action "emojiSelected"}}
|
||||
@onEmojiPickerClose={{action "closeEmojiPicker"}}
|
||||
@emojiSelected={{this.emojiSelected}}
|
||||
@onEmojiPickerClose={{this.closeEmojiPicker}}
|
||||
/>
|
||||
|
||||
<SettingValidationMessage @message={{this.validationMessage}} />
|
||||
@@ -1,5 +1,5 @@
|
||||
<Input
|
||||
@type="checkbox"
|
||||
@checked={{this.checked}}
|
||||
{{on "click" (action "onChange")}}
|
||||
{{on "click" this.onChange}}
|
||||
/>
|
||||
@@ -1,5 +1,5 @@
|
||||
<SearchAdvancedCategoryChooser
|
||||
@value={{this.category}}
|
||||
@onChange={{action "onChange"}}
|
||||
@onChange={{this.onChange}}
|
||||
@options={{hash filterable=true}}
|
||||
/>
|
||||
@@ -10,13 +10,13 @@
|
||||
<Input
|
||||
@value={{value.key}}
|
||||
class="value-input"
|
||||
{{on "focusout" (fn (action "changeKey") index)}}
|
||||
{{on "focusout" (fn this.changeKey index)}}
|
||||
/>
|
||||
<Input
|
||||
@value={{value.secret}}
|
||||
class="value-input"
|
||||
@type={{if this.isSecret "password" "text"}}
|
||||
{{on "focusout" (fn (action "changeSecret") index)}}
|
||||
{{on "focusout" (fn this.changeSecret index)}}
|
||||
/>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<CategorySelector
|
||||
@categories={{this.selectedCategories}}
|
||||
@onChange={{action "onChangeSelectedCategories"}}
|
||||
@onChange={{this.onChangeSelectedCategories}}
|
||||
/>
|
||||
|
||||
<div class="desc">{{html-safe this.setting.description}}</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@valid={{this.valid}}
|
||||
@onlyHex={{false}}
|
||||
@styleSelection={{false}}
|
||||
@onChangeColor={{action "onChangeColor"}}
|
||||
@onChangeColor={{this.onChangeColor}}
|
||||
/>
|
||||
<SettingValidationMessage @message={{this.validationMessage}} />
|
||||
<div class="desc">{{html-safe this.setting.description}}</div>
|
||||
@@ -2,8 +2,8 @@
|
||||
@value={{this.settingValue}}
|
||||
@settingName={{this.setting.setting}}
|
||||
@choices={{this.settingChoices}}
|
||||
@onChange={{action "onChangeListSetting"}}
|
||||
@onChangeChoices={{action "onChangeChoices"}}
|
||||
@onChange={{this.onChangeListSetting}}
|
||||
@onChangeChoices={{this.onChangeChoices}}
|
||||
@options={{hash allowAny=this.allowAny}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@settingName="name"
|
||||
@nameProperty={{this.nameProperty}}
|
||||
@valueProperty={{this.valueProperty}}
|
||||
@onChange={{action "onChangeGroupListSetting"}}
|
||||
@onChange={{this.onChangeGroupListSetting}}
|
||||
/>
|
||||
<SettingValidationMessage @message={{this.validationMessage}} />
|
||||
<div class="desc">{{html-safe this.setting.description}}</div>
|
||||
@@ -2,7 +2,7 @@
|
||||
@value={{this.settingValue}}
|
||||
@settingName={{this.setting.setting}}
|
||||
@choices={{this.settingValue}}
|
||||
@onChange={{action "onChange"}}
|
||||
@onChange={{this.onChange}}
|
||||
@options={{hash allowAny=this.allowAny}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@choices={{this.settingChoices}}
|
||||
@nameProperty="name"
|
||||
@valueProperty="value"
|
||||
@onChange={{action "onChangeListSetting"}}
|
||||
@onChange={{this.onChangeListSetting}}
|
||||
@options={{hash allowAny=this.allowAny}}
|
||||
/>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<SimpleList
|
||||
@values={{this.value}}
|
||||
@inputDelimiter={{this.inputDelimiter}}
|
||||
@onChange={{action "onChange"}}
|
||||
@onChange={{this.onChange}}
|
||||
@choices={{this.setting.choices}}
|
||||
@allowAny={{this.setting.allow_any}}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<TagGroupChooser
|
||||
@tagGroups={{this.selectedTagGroups}}
|
||||
@onChange={{action "onTagGroupChange"}}
|
||||
@onChange={{this.onTagGroupChange}}
|
||||
@options={{hash filterPlaceholder="category.required_tag_group.placeholder"}}
|
||||
/>
|
||||
<div class="desc">{{html-safe this.setting.description}}</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<TagChooser
|
||||
@tags={{this.selectedTags}}
|
||||
@onChange={{action "changeSelectedTags"}}
|
||||
@onChange={{this.changeSelectedTags}}
|
||||
@everyTag={{true}}
|
||||
@unlimitedTagCount={{true}}
|
||||
@options={{hash allowAny=false}}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
title={{value}}
|
||||
@value={{value}}
|
||||
class="value-input"
|
||||
{{on "focusout" (fn (action "changeValue") index)}}
|
||||
{{on "focusout" (fn this.changeValue index)}}
|
||||
/>
|
||||
|
||||
{{#if this.showUpDownButtons}}
|
||||
@@ -37,6 +37,6 @@
|
||||
@nameProperty={{null}}
|
||||
@value={{this.newValue}}
|
||||
@content={{this.filteredChoices}}
|
||||
@onChange={{action "selectChoice"}}
|
||||
@onChange={{this.selectChoice}}
|
||||
@options={{hash allowAny=true none=this.noneKey}}
|
||||
/>
|
||||
@@ -38,7 +38,7 @@
|
||||
@id="watched-tag"
|
||||
@class="watched-word-input-field"
|
||||
@tags={{this.selectedTags}}
|
||||
@onChange={{action "changeSelectedTags"}}
|
||||
@onChange={{this.changeSelectedTags}}
|
||||
@everyTag={{true}}
|
||||
@options={{hash allowAny=true disabled=this.formSubmitted}}
|
||||
/>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{#each this.messages as |message|}}
|
||||
<ComposerMessage
|
||||
@message={{message}}
|
||||
@closeMessage={{action "closeMessage"}}
|
||||
@closeMessage={{this.closeMessage}}
|
||||
@shareModal={{fn (mut this.showShareModal) true}}
|
||||
@switchPM={{action "switchPM"}}
|
||||
@switchPM={{this.switchPM}}
|
||||
/>
|
||||
{{#if this.showShareModal}}
|
||||
<Modal::ShareTopic
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
placementStrategy="absolute"
|
||||
}}
|
||||
@content={{@headerActions}}
|
||||
@onChange={{action "handleMultipleHeaderActions"}}
|
||||
@onChange={{this.handleMultipleHeaderActions}}
|
||||
@class="sidebar-section-header-dropdown"
|
||||
/>
|
||||
{{/if}}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="btn-emoji btn-flat"
|
||||
onclick={{action "toggleEmojiPicker"}}
|
||||
onclick={{this.toggleEmojiPicker}}
|
||||
{{on "focus" this.focus}}
|
||||
{{on "blur" this.blur}}
|
||||
>
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
<EmojiPicker
|
||||
@isActive={{this.emojiPickerIsActive}}
|
||||
@emojiSelected={{action "emojiSelected"}}
|
||||
@onEmojiPickerClose={{action "onEmojiPickerOutsideClick"}}
|
||||
@emojiSelected={{this.emojiSelected}}
|
||||
@onEmojiPickerClose={{this.onEmojiPickerOutsideClick}}
|
||||
@placement="bottom"
|
||||
/>
|
||||
Reference in New Issue
Block a user