DEV: remove slightly less trivial {{action}} usages (#24289)

Follow-up to #24278 that is slightly less trivial.

* Some were "trivial" usages that were missed in the previous PR because the same file that had at least one other non-trivial usage.
* These involve extra arguments or inheritance but I have checked that they seem correct.
This commit is contained in:
Godfrey Chan 2023-11-13 04:29:20 -08:00 committed by GitHub
parent fcafc8872f
commit 8444c865e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 31 additions and 31 deletions

View File

@ -28,7 +28,7 @@
<Input <Input
@type="checkbox" @type="checkbox"
disabled={{not (get user this.penaltyField)}} disabled={{not (get user this.penaltyField)}}
{{on "click" (action "selectUserId" user.id)}} {{on "click" (fn this.selectUserId user.id)}}
/> />
</td> </td>
<td>{{avatar user imageSize="small"}} {{user.username}}</td> <td>{{avatar user imageSize="small"}} {{user.username}}</td>

View File

@ -8,7 +8,7 @@
@currentSortDirection={{this.sortDirection}} @currentSortDirection={{this.sortDirection}}
@currentSortLabel={{this.sortLabel}} @currentSortLabel={{this.sortLabel}}
@label={{label}} @label={{label}}
@sortByLabel={{action "sortByLabel" label}} @sortByLabel={{fn this.sortByLabel label}}
/> />
{{/each}} {{/each}}
{{else}} {{else}}

View File

@ -79,8 +79,8 @@
<Input <Input
@type={{this.text}} @type={{this.text}}
@value={{this.newFieldName}} @value={{this.newFieldName}}
@enter={{action "addField"}} @enter={{this.addField}}
@escape-press={{action "cancelAddField"}} @escape-press={{this.cancelAddField}}
/> />
<DButton <DButton
@action={{fn this.addField this.newFieldName}} @action={{fn this.addField this.newFieldName}}
@ -126,5 +126,5 @@
@placeholder={{this.placeholder}} @placeholder={{this.placeholder}}
@htmlPlaceholder={{true}} @htmlPlaceholder={{true}}
@save={{this.save}} @save={{this.save}}
@setWarning={{action "setWarning"}} @setWarning={{this.setWarning}}
/> />

View File

@ -2,7 +2,7 @@
@class="hex-input" @class="hex-input"
@value={{this.hexValue}} @value={{this.hexValue}}
@maxlength={{this.maxlength}} @maxlength={{this.maxlength}}
@input={{action "onHexInput" value="target.value"}} @input={{this.onHexInput}}
/> />
<input <input
class="picker" class="picker"

View File

@ -44,9 +44,9 @@ export default class ColorInput extends Component {
} }
@action @action
onHexInput(color) { onHexInput(event) {
if (this.attrs.onChangeColor) { if (this.attrs.onChangeColor) {
this.attrs.onChangeColor(this.normalize(color || "")); this.attrs.onChangeColor(this.normalize(event.target.value || ""));
} }
} }

View File

@ -4,7 +4,7 @@
<Input <Input
@value={{this.buffered.host}} @value={{this.buffered.host}}
placeholder="example.com" placeholder="example.com"
@enter={{action "save"}} @enter={{this.save}}
class="host-name" class="host-name"
autofocus={{true}} autofocus={{true}}
/> />
@ -14,7 +14,7 @@
<Input <Input
@value={{this.buffered.allowed_paths}} @value={{this.buffered.allowed_paths}}
placeholder="/blog/.*" placeholder="/blog/.*"
@enter={{action "save"}} @enter={{this.save}}
class="path-allowlist" class="path-allowlist"
/> />
</td> </td>

View File

@ -25,7 +25,7 @@
@placeholderKey={{this.permalinkTypePlaceholder}} @placeholderKey={{this.permalinkTypePlaceholder}}
@autocorrect="off" @autocorrect="off"
@autocapitalize="off" @autocapitalize="off"
@keyDown={{action "submitFormOnEnter"}} @keyDown={{this.submitFormOnEnter}}
/> />
<DButton <DButton

View File

@ -2,7 +2,7 @@
@valueProperty="value" @valueProperty="value"
@content={{this.groupOptions}} @content={{this.groupOptions}}
@value={{this.groupId}} @value={{this.groupId}}
@onChange={{action "onChange"}} @onChange={{this.onChange}}
@options={{hash @options={{hash
allowAny=this.filter.allow_any allowAny=this.filter.allow_any
filterable=true filterable=true

View File

@ -1,7 +1,7 @@
<ComboBox <ComboBox
@content={{this.filter.choices}} @content={{this.filter.choices}}
@value={{this.filter.default}} @value={{this.filter.default}}
@onChange={{action "onChange"}} @onChange={{this.onChange}}
@options={{hash @options={{hash
allowAny=this.filter.allow_any allowAny=this.filter.allow_any
filterable=true filterable=true

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}}

View File

@ -34,7 +34,7 @@
{{#each this.activeThemes as |theme|}} {{#each this.activeThemes as |theme|}}
<ThemesListItem <ThemesListItem
@theme={{theme}} @theme={{theme}}
@navigateToTheme={{action "navigateToTheme" theme}} @navigateToTheme={{fn this.navigateToTheme theme}}
/> />
{{/each}} {{/each}}
@ -106,7 +106,7 @@
<ThemesListItem <ThemesListItem
@classNames="inactive-theme" @classNames="inactive-theme"
@theme={{theme}} @theme={{theme}}
@navigateToTheme={{action "navigateToTheme" theme}} @navigateToTheme={{fn this.navigateToTheme theme}}
@selectInactiveMode={{this.selectInactiveMode}} @selectInactiveMode={{this.selectInactiveMode}}
/> />
{{/each}} {{/each}}

View File

@ -62,7 +62,7 @@
<TimeShortcutPicker <TimeShortcutPicker
@timeShortcuts={{this.timeOptions}} @timeShortcuts={{this.timeOptions}}
@prefilledDatetime={{this.prefilledDatetime}} @prefilledDatetime={{this.prefilledDatetime}}
@onTimeSelected={{action "onTimeSelected"}} @onTimeSelected={{this.onTimeSelected}}
@hiddenOptions={{this.hiddenTimeShortcutOptions}} @hiddenOptions={{this.hiddenTimeShortcutOptions}}
@customLabels={{this.customTimeShortcutLabels}} @customLabels={{this.customTimeShortcutLabels}}
@_itsatrap={{this._itsatrap}} @_itsatrap={{this._itsatrap}}
@ -82,7 +82,7 @@
id="save-bookmark" id="save-bookmark"
class="btn-primary" class="btn-primary"
/> />
<DModalCancel @close={{action "closeWithoutSavingBookmark"}} /> <DModalCancel @close={{this.closeWithoutSavingBookmark}} />
{{#if this.showDelete}} {{#if this.showDelete}}
<DButton <DButton
@icon="trash-alt" @icon="trash-alt"

View File

@ -40,7 +40,7 @@
{{/if}} {{/if}}
<div class="input-group create-account-email"> <div class="input-group create-account-email">
<Input <Input
{{on "focusout" (action "checkEmailAvailability")}} {{on "focusout" this.checkEmailAvailability}}
@type="email" @type="email"
@value={{this.model.accountEmail}} @value={{this.model.accountEmail}}
disabled={{this.emailDisabled}} disabled={{this.emailDisabled}}
@ -253,7 +253,7 @@
</div> </div>
<DButton <DButton
@action={{action "createAccount"}} @action={{this.createAccount}}
@disabled={{this.submitDisabled}} @disabled={{this.submitDisabled}}
@label="create_account.title" @label="create_account.title"
@isLoading={{this.formSubmitted}} @isLoading={{this.formSubmitted}}
@ -279,7 +279,7 @@
{{#if this.showExternalLoginButtons}} {{#if this.showExternalLoginButtons}}
<div class="create-account-login-buttons"> <div class="create-account-login-buttons">
<LoginButtons @externalLogin={{action "externalLogin"}} /> <LoginButtons @externalLogin={{this.externalLogin}} />
</div> </div>
{{/if}} {{/if}}

View File

@ -59,7 +59,7 @@
disabled={{not disabled={{not
(includes this.filteredCategoryIds category.id) (includes this.filteredCategoryIds category.id)
}} }}
{{on "click" (action "toggleCategory" category.id)}} {{on "click" (fn this.toggleCategory category.id)}}
/> />
</label> </label>
</div> </div>

View File

@ -34,7 +34,7 @@
class="sidebar-tags-form__input" class="sidebar-tags-form__input"
@type="checkbox" @type="checkbox"
@checked={{includes this.selectedTags tag.name}} @checked={{includes this.selectedTags tag.name}}
{{on "click" (action "toggleTag" tag.name)}} {{on "click" (fn this.toggleTag tag.name)}}
/> />
<label <label

View File

@ -26,7 +26,7 @@
id="public-channels-caret" id="public-channels-caret"
role="button" role="button"
title="toggle nav list" title="toggle nav list"
{{on "click" (action "toggleChannelSection" "public-channels")}} {{on "click" (fn this.toggleChannelSection "public-channels")}}
data-toggleable="public-channels" data-toggleable="public-channels"
> >
{{d-icon "angle-up"}} {{d-icon "angle-up"}}
@ -86,7 +86,7 @@
title="toggle nav list" title="toggle nav list"
{{on {{on
"click" "click"
(action "toggleChannelSection" "direct-message-channels") (fn this.toggleChannelSection "direct-message-channels")
}} }}
data-toggleable="direct-message-channels" data-toggleable="direct-message-channels"
> >

View File

@ -43,7 +43,7 @@
<DcFilterInput <DcFilterInput
@class="filter-input" @class="filter-input"
@filterAction={{action "debouncedFiltering"}} @filterAction={{this.debouncedFiltering}}
@icons={{hash right="search"}} @icons={{hash right="search"}}
placeholder={{i18n "chat.browse.filter_input_placeholder"}} placeholder={{i18n "chat.browse.filter_input_placeholder"}}
{{did-insert (action this.focusFilterInput)}} {{did-insert (action this.focusFilterInput)}}

View File

@ -18,7 +18,7 @@
}} }}
@type="text" @type="text"
@value={{this.editedName}} @value={{this.editedName}}
{{on "input" (action "onChangeChatChannelName" value="target.value")}} {{on "input" this.onChangeChatChannelName}}
/> />
</div> </div>
@ -34,7 +34,7 @@
name="channel-slug" name="channel-slug"
class="chat-channel-edit-name-slug-modal__slug-input" class="chat-channel-edit-name-slug-modal__slug-input"
placeholder={{this.autoGeneratedSlug}} placeholder={{this.autoGeneratedSlug}}
{{on "input" (action "onChangeChatChannelSlug" value="target.value")}} {{on "input" this.onChangeChatChannelSlug}}
@type="text" @type="text"
@value={{this.editedSlug}} @value={{this.editedSlug}}
/> />

View File

@ -57,9 +57,9 @@ export default class ChatModalEditChannelName extends Component {
} }
@action @action
onChangeChatChannelName(title) { onChangeChatChannelName(event) {
this.flash = null; this.flash = null;
this.#debouncedGenerateSlug(title); this.#debouncedGenerateSlug(event?.target?.value);
} }
@action @action

View File

@ -53,7 +53,7 @@
}}</label> }}</label>
<Textarea <Textarea
@value={{this.pollOptionsText}} @value={{this.pollOptionsText}}
{{on "input" (action "onOptionsTextChange")}} {{on "input" this.onOptionsTextChange}}
/> />
{{#if this.showMinNumOfOptionsValidation}} {{#if this.showMinNumOfOptionsValidation}}
{{#unless this.minNumOfOptionsValidation.ok}} {{#unless this.minNumOfOptionsValidation.ok}}