A platform for community discussion. Free, open, simple.
DEV: Remove unnecessary `if`s in templates (#36503)
Jarek Radoszd80cdfb7450f
diff --git a/frontend/discourse/admin/components/admin-report-table.gjs b/frontend/discourse/admin/components/admin-report-table.gjsindex 8c5dcc77430..728edd5a51c 100644--- a/frontend/discourse/admin/components/admin-report-table.gjs+++ b/frontend/discourse/admin/components/admin-report-table.gjs@@ -194,21 +194,19 @@ export default class AdminReportTable extends Component {<table class="table"><thead><tr>- {{#if this.model.computedLabels}}- {{#each this.model.computedLabels as |label|}}- <AdminReportTableHeader- @showSortingUI={{this.showSortingUI}}- @currentSortDirection={{this.sortDirection}}- @currentSortLabel={{this.sortLabel}}- @label={{label}}- @sortByLabel={{fn this.sortByLabel label}}- />- {{/each}}+ {{#each this.model.computedLabels as |label|}}+ <AdminReportTableHeader+ @showSortingUI={{this.showSortingUI}}+ @currentSortDirection={{this.sortDirection}}+ @currentSortLabel={{this.sortLabel}}+ @label={{label}}+ @sortByLabel={{fn this.sortByLabel label}}+ />{{else}}{{#each this.model.data as |data|}}<th>{{data.x}}</th>{{/each}}- {{/if}}+ {{/each}}</tr></thead><tbody>diff --git a/frontend/discourse/app/components/about-page-extra-groups.gjs b/frontend/discourse/app/components/about-page-extra-groups.gjsindex 4e1aef4d0ba..61f3481e413 100644--- a/frontend/discourse/app/components/about-page-extra-groups.gjs+++ b/frontend/discourse/app/components/about-page-extra-groups.gjs@@ -110,26 +110,24 @@ export default class AboutPageExtraGroups extends Component {<template><ConditionalLoadingSpinner @condition={{this.loading}}>- {{#if this.groups}}- {{#each this.groups as |group|}}- <section- class="about__{{group.name}}- --custom-group- {{if this.showGroupDescription '--has-description'}}"- >- <h3>- <a href="/g/{{group.name}}">{{this.groupName group}}</a>- </h3>- {{#if this.showGroupDescription}}- <p>{{htmlSafe group.bio_cooked}}</p>- {{/if}}- <AboutPageUsers- @users={{group.members}}- @truncateAt={{this.showInitialMembers}}- />- </section>- {{/each}}- {{/if}}+ {{#each this.groups as |group|}}+ <section+ class="about__{{group.name}}+ --custom-group+ {{if this.showGroupDescription '--has-description'}}"+ >+ <h3>+ <a href="/g/{{group.name}}">{{this.groupName group}}</a>+ </h3>+ {{#if this.showGroupDescription}}+ <p>{{htmlSafe group.bio_cooked}}</p>+ {{/if}}+ <AboutPageUsers+ @users={{group.members}}+ @truncateAt={{this.showInitialMembers}}+ />+ </section>+ {{/each}}</ConditionalLoadingSpinner></template>}diff --git a/frontend/discourse/app/components/search-menu/results/type/user.gjs b/frontend/discourse/app/components/search-menu/results/type/user.gjsindex d6e2d270cc0..4a2b31b908a 100644--- a/frontend/discourse/app/components/search-menu/results/type/user.gjs+++ b/frontend/discourse/app/components/search-menu/results/type/user.gjs@@ -16,11 +16,9 @@ const User = <template><span class="username">{{formatUsername @result.username}}</span>- {{#if @result.custom_data}}- {{#each @result.custom_data as |row|}}- <span class="custom-field">{{row.name}}: {{row.value}}</span>- {{/each}}- {{/if}}+ {{#each @result.custom_data as |row|}}+ <span class="custom-field">{{row.name}}: {{row.value}}</span>+ {{/each}}</div></template>;diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjsindex 1439024e607..801978b5bee 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs+++ b/plugins/chat/assets/javascripts/discourse/components/chat-composer.gjs@@ -794,23 +794,17 @@ export default class ChatComposer extends Component {/></div>- {{#if this.inlineButtons.length}}- {{#each this.inlineButtons as |button|}}- <DButton- @icon={{button.icon}}- class="-{{button.id}}"- disabled={{or this.disabled button.disabled}}- tabindex={{if button.disabled -1 0}}- {{on- "click"- (fn this.handleInlineButtonAction button.action)- }}- {{on "focus" (fn this.computeIsFocused true)}}- {{on "blur" (fn this.computeIsFocused false)}}- />- {{/each}}-- {{/if}}+ {{#each this.inlineButtons as |button|}}+ <DButton+ @icon={{button.icon}}+ class="-{{button.id}}"+ disabled={{or this.disabled button.disabled}}+ tabindex={{if button.disabled -1 0}}+ {{on "click" (fn this.handleInlineButtonAction button.action)}}+ {{on "focus" (fn this.computeIsFocused true)}}+ {{on "blur" (fn this.computeIsFocused false)}}+ />+ {{/each}}<PluginOutlet@name="chat-composer-inline-buttons"diff --git a/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs b/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjsindex 88e2dbb7649..e1d6ed455d8 100644--- a/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs+++ b/plugins/poll/assets/javascripts/discourse/components/poll-results-ranked-choice.gjs@@ -31,27 +31,25 @@ export default class PollResultsRankedChoiceComponent extends Component {</tr></thead><tbody>- {{#if @rankedChoiceOutcome}}- {{#each @rankedChoiceOutcome.round_activity as |round|}}- {{#if round.majority}}- <tr>- <td>{{round.round}}</td>- <td>{{htmlSafe round.majority.html}}</td>- <td>{{i18n "poll.ranked_choice.none"}}</td>- </tr>- {{else}}- <tr>- <td>{{round.round}}</td>- <td>{{i18n "poll.ranked_choice.none"}}</td>- <td>- {{#each round.eliminated as |eliminated|}}- {{htmlSafe eliminated.html}}- {{/each}}- </td>- </tr>- {{/if}}- {{/each}}- {{/if}}+ {{#each @rankedChoiceOutcome.round_activity as |round|}}+ {{#if round.majority}}+ <tr>+ <td>{{round.round}}</td>+ <td>{{htmlSafe round.majority.html}}</td>+ <td>{{i18n "poll.ranked_choice.none"}}</td>+ </tr>+ {{else}}+ <tr>+ <td>{{round.round}}</td>+ <td>{{i18n "poll.ranked_choice.none"}}</td>+ <td>+ {{#each round.eliminated as |eliminated|}}+ {{htmlSafe eliminated.html}}+ {{/each}}+ </td>+ </tr>+ {{/if}}+ {{/each}}</tbody></table><h3 class="poll-results-ranked-choice-subtitle-outcome">