Skip to content

Commit

Permalink
Fix search popout including full-text search instructions when full-t…
Browse files Browse the repository at this point in the history
…ext search is disabled (mastodon#26755)
  • Loading branch information
ClearlyClaire authored Sep 1, 2023
1 parent 5c0a9aa commit 6c4c724
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions app/javascript/mastodon/features/compose/components/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Search extends PureComponent {

handleKeyDown = (e) => {
const { selectedOption } = this.state;
const options = this._getOptions().concat(this.defaultOptions);
const options = searchEnabled ? this._getOptions().concat(this.defaultOptions) : this._getOptions();

switch(e.key) {
case 'Escape':
Expand Down Expand Up @@ -353,15 +353,19 @@ class Search extends PureComponent {
</>
)}

<h4><FormattedMessage id='search_popout.options' defaultMessage='Search options' /></h4>
{searchEnabled && (
<>
<h4><FormattedMessage id='search_popout.options' defaultMessage='Search options' /></h4>

<div className='search__popout__menu'>
{this.defaultOptions.map(({ key, label, action }, i) => (
<button key={key} onMouseDown={action} className={classNames('search__popout__menu__item', { selected: selectedOption === (options.length + i) })}>
{label}
</button>
))}
</div>
<div className='search__popout__menu'>
{this.defaultOptions.map(({ key, label, action }, i) => (
<button key={key} onMouseDown={action} className={classNames('search__popout__menu__item', { selected: selectedOption === (options.length + i) })}>
{label}
</button>
))}
</div>
</>
)}
</div>
</div>
);
Expand Down

0 comments on commit 6c4c724

Please sign in to comment.