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:
Godfrey Chan
2023-11-08 01:53:06 -08:00
committed by GitHub
parent 184f038cbf
commit 82506096b7
21 changed files with 29 additions and 29 deletions

View File

@@ -7,7 +7,7 @@
<ComboBox <ComboBox
@value={{this.postAction}} @value={{this.postAction}}
@content={{this.penaltyActions}} @content={{this.penaltyActions}}
@onChange={{action "penaltyChanged"}} @onChange={{this.penaltyChanged}}
/> />
</div> </div>

View File

@@ -182,7 +182,7 @@
<DateTimeInputRange <DateTimeInputRange
@from={{this.startDate}} @from={{this.startDate}}
@to={{this.endDate}} @to={{this.endDate}}
@onChange={{action "onChangeDateRange"}} @onChange={{this.onChangeDateRange}}
@showFromTime={{false}} @showFromTime={{false}}
@showToTime={{false}} @showToTime={{false}}
/> />
@@ -205,7 +205,7 @@
(concat "report-filters/" filter.type) (concat "report-filters/" filter.type)
model=this.model model=this.model
filter=filter filter=filter
applyFilter=(action "applyFilter") applyFilter=this.applyFilter
}} }}
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
<span <span
role="button" role="button"
onclick={{action "deleteWord"}} onclick={{this.deleteWord}}
class="delete-word-record" class="delete-word-record"
>{{d-icon "times"}}</span> >{{d-icon "times"}}</span>
{{this.word.word}} {{this.word.word}}

View File

@@ -54,8 +54,8 @@
<EmojiPicker <EmojiPicker
@isActive={{this.emojiPickerIsActive}} @isActive={{this.emojiPickerIsActive}}
@isEditorFocused={{this.isEditorFocused}} @isEditorFocused={{this.isEditorFocused}}
@emojiSelected={{action "emojiSelected"}} @emojiSelected={{this.emojiSelected}}
@onEmojiPickerClose={{action "closeEmojiPicker"}} @onEmojiPickerClose={{this.closeEmojiPicker}}
/> />
<SettingValidationMessage @message={{this.validationMessage}} /> <SettingValidationMessage @message={{this.validationMessage}} />

View File

@@ -1,5 +1,5 @@
<Input <Input
@type="checkbox" @type="checkbox"
@checked={{this.checked}} @checked={{this.checked}}
{{on "click" (action "onChange")}} {{on "click" this.onChange}}
/> />

View File

@@ -1,5 +1,5 @@
<SearchAdvancedCategoryChooser <SearchAdvancedCategoryChooser
@value={{this.category}} @value={{this.category}}
@onChange={{action "onChange"}} @onChange={{this.onChange}}
@options={{hash filterable=true}} @options={{hash filterable=true}}
/> />

View File

@@ -10,13 +10,13 @@
<Input <Input
@value={{value.key}} @value={{value.key}}
class="value-input" class="value-input"
{{on "focusout" (fn (action "changeKey") index)}} {{on "focusout" (fn this.changeKey index)}}
/> />
<Input <Input
@value={{value.secret}} @value={{value.secret}}
class="value-input" class="value-input"
@type={{if this.isSecret "password" "text"}} @type={{if this.isSecret "password" "text"}}
{{on "focusout" (fn (action "changeSecret") index)}} {{on "focusout" (fn this.changeSecret index)}}
/> />
</div> </div>
{{/each}} {{/each}}

View File

@@ -1,6 +1,6 @@
<CategorySelector <CategorySelector
@categories={{this.selectedCategories}} @categories={{this.selectedCategories}}
@onChange={{action "onChangeSelectedCategories"}} @onChange={{this.onChangeSelectedCategories}}
/> />
<div class="desc">{{html-safe this.setting.description}}</div> <div class="desc">{{html-safe this.setting.description}}</div>

View File

@@ -3,7 +3,7 @@
@valid={{this.valid}} @valid={{this.valid}}
@onlyHex={{false}} @onlyHex={{false}}
@styleSelection={{false}} @styleSelection={{false}}
@onChangeColor={{action "onChangeColor"}} @onChangeColor={{this.onChangeColor}}
/> />
<SettingValidationMessage @message={{this.validationMessage}} /> <SettingValidationMessage @message={{this.validationMessage}} />
<div class="desc">{{html-safe this.setting.description}}</div> <div class="desc">{{html-safe this.setting.description}}</div>

View File

@@ -2,8 +2,8 @@
@value={{this.settingValue}} @value={{this.settingValue}}
@settingName={{this.setting.setting}} @settingName={{this.setting.setting}}
@choices={{this.settingChoices}} @choices={{this.settingChoices}}
@onChange={{action "onChangeListSetting"}} @onChange={{this.onChangeListSetting}}
@onChangeChoices={{action "onChangeChoices"}} @onChangeChoices={{this.onChangeChoices}}
@options={{hash allowAny=this.allowAny}} @options={{hash allowAny=this.allowAny}}
/> />

View File

@@ -4,7 +4,7 @@
@settingName="name" @settingName="name"
@nameProperty={{this.nameProperty}} @nameProperty={{this.nameProperty}}
@valueProperty={{this.valueProperty}} @valueProperty={{this.valueProperty}}
@onChange={{action "onChangeGroupListSetting"}} @onChange={{this.onChangeGroupListSetting}}
/> />
<SettingValidationMessage @message={{this.validationMessage}} /> <SettingValidationMessage @message={{this.validationMessage}} />
<div class="desc">{{html-safe this.setting.description}}</div> <div class="desc">{{html-safe this.setting.description}}</div>

View File

@@ -2,7 +2,7 @@
@value={{this.settingValue}} @value={{this.settingValue}}
@settingName={{this.setting.setting}} @settingName={{this.setting.setting}}
@choices={{this.settingValue}} @choices={{this.settingValue}}
@onChange={{action "onChange"}} @onChange={{this.onChange}}
@options={{hash allowAny=this.allowAny}} @options={{hash allowAny=this.allowAny}}
/> />

View File

@@ -4,7 +4,7 @@
@choices={{this.settingChoices}} @choices={{this.settingChoices}}
@nameProperty="name" @nameProperty="name"
@valueProperty="value" @valueProperty="value"
@onChange={{action "onChangeListSetting"}} @onChange={{this.onChangeListSetting}}
@options={{hash allowAny=this.allowAny}} @options={{hash allowAny=this.allowAny}}
/> />

View File

@@ -1,7 +1,7 @@
<SimpleList <SimpleList
@values={{this.value}} @values={{this.value}}
@inputDelimiter={{this.inputDelimiter}} @inputDelimiter={{this.inputDelimiter}}
@onChange={{action "onChange"}} @onChange={{this.onChange}}
@choices={{this.setting.choices}} @choices={{this.setting.choices}}
@allowAny={{this.setting.allow_any}} @allowAny={{this.setting.allow_any}}
/> />

View File

@@ -1,6 +1,6 @@
<TagGroupChooser <TagGroupChooser
@tagGroups={{this.selectedTagGroups}} @tagGroups={{this.selectedTagGroups}}
@onChange={{action "onTagGroupChange"}} @onChange={{this.onTagGroupChange}}
@options={{hash filterPlaceholder="category.required_tag_group.placeholder"}} @options={{hash filterPlaceholder="category.required_tag_group.placeholder"}}
/> />
<div class="desc">{{html-safe this.setting.description}}</div> <div class="desc">{{html-safe this.setting.description}}</div>

View File

@@ -1,6 +1,6 @@
<TagChooser <TagChooser
@tags={{this.selectedTags}} @tags={{this.selectedTags}}
@onChange={{action "changeSelectedTags"}} @onChange={{this.changeSelectedTags}}
@everyTag={{true}} @everyTag={{true}}
@unlimitedTagCount={{true}} @unlimitedTagCount={{true}}
@options={{hash allowAny=false}} @options={{hash allowAny=false}}

View File

@@ -12,7 +12,7 @@
title={{value}} title={{value}}
@value={{value}} @value={{value}}
class="value-input" class="value-input"
{{on "focusout" (fn (action "changeValue") index)}} {{on "focusout" (fn this.changeValue index)}}
/> />
{{#if this.showUpDownButtons}} {{#if this.showUpDownButtons}}
@@ -37,6 +37,6 @@
@nameProperty={{null}} @nameProperty={{null}}
@value={{this.newValue}} @value={{this.newValue}}
@content={{this.filteredChoices}} @content={{this.filteredChoices}}
@onChange={{action "selectChoice"}} @onChange={{this.selectChoice}}
@options={{hash allowAny=true none=this.noneKey}} @options={{hash allowAny=true none=this.noneKey}}
/> />

View File

@@ -38,7 +38,7 @@
@id="watched-tag" @id="watched-tag"
@class="watched-word-input-field" @class="watched-word-input-field"
@tags={{this.selectedTags}} @tags={{this.selectedTags}}
@onChange={{action "changeSelectedTags"}} @onChange={{this.changeSelectedTags}}
@everyTag={{true}} @everyTag={{true}}
@options={{hash allowAny=true disabled=this.formSubmitted}} @options={{hash allowAny=true disabled=this.formSubmitted}}
/> />

View File

@@ -1,9 +1,9 @@
{{#each this.messages as |message|}} {{#each this.messages as |message|}}
<ComposerMessage <ComposerMessage
@message={{message}} @message={{message}}
@closeMessage={{action "closeMessage"}} @closeMessage={{this.closeMessage}}
@shareModal={{fn (mut this.showShareModal) true}} @shareModal={{fn (mut this.showShareModal) true}}
@switchPM={{action "switchPM"}} @switchPM={{this.switchPM}}
/> />
{{#if this.showShareModal}} {{#if this.showShareModal}}
<Modal::ShareTopic <Modal::ShareTopic

View File

@@ -55,7 +55,7 @@
placementStrategy="absolute" placementStrategy="absolute"
}} }}
@content={{@headerActions}} @content={{@headerActions}}
@onChange={{action "handleMultipleHeaderActions"}} @onChange={{this.handleMultipleHeaderActions}}
@class="sidebar-section-header-dropdown" @class="sidebar-section-header-dropdown"
/> />
{{/if}} {{/if}}

View File

@@ -6,7 +6,7 @@
<button <button
type="button" type="button"
class="btn-emoji btn-flat" class="btn-emoji btn-flat"
onclick={{action "toggleEmojiPicker"}} onclick={{this.toggleEmojiPicker}}
{{on "focus" this.focus}} {{on "focus" this.focus}}
{{on "blur" this.blur}} {{on "blur" this.blur}}
> >
@@ -29,7 +29,7 @@
</div> </div>
<EmojiPicker <EmojiPicker
@isActive={{this.emojiPickerIsActive}} @isActive={{this.emojiPickerIsActive}}
@emojiSelected={{action "emojiSelected"}} @emojiSelected={{this.emojiSelected}}
@onEmojiPickerClose={{action "onEmojiPickerOutsideClick"}} @onEmojiPickerClose={{this.onEmojiPickerOutsideClick}}
@placement="bottom" @placement="bottom"
/> />