[Glitch] Change search popout to not list unusable search options when logged out
Port 6e70819840
to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
b135b6ba8f
commit
9bfb699c4c
|
@ -271,6 +271,7 @@ class Search extends PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
_calculateOptions (value) {
|
_calculateOptions (value) {
|
||||||
|
const { signedIn } = this.context.identity;
|
||||||
const trimmedValue = value.trim();
|
const trimmedValue = value.trim();
|
||||||
const options = [];
|
const options = [];
|
||||||
|
|
||||||
|
@ -295,7 +296,7 @@ class Search extends PureComponent {
|
||||||
|
|
||||||
const couldBeStatusSearch = searchEnabled;
|
const couldBeStatusSearch = searchEnabled;
|
||||||
|
|
||||||
if (couldBeStatusSearch) {
|
if (couldBeStatusSearch && signedIn) {
|
||||||
options.push({ key: 'status-search', label: <FormattedMessage id='search.quick_action.status_search' defaultMessage='Posts matching {x}' values={{ x: <mark>{trimmedValue}</mark> }} />, action: this.handleStatusSearch });
|
options.push({ key: 'status-search', label: <FormattedMessage id='search.quick_action.status_search' defaultMessage='Posts matching {x}' values={{ x: <mark>{trimmedValue}</mark> }} />, action: this.handleStatusSearch });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +373,7 @@ class Search extends PureComponent {
|
||||||
|
|
||||||
<h4><FormattedMessage id='search_popout.options' defaultMessage='Search options' /></h4>
|
<h4><FormattedMessage id='search_popout.options' defaultMessage='Search options' /></h4>
|
||||||
|
|
||||||
{searchEnabled ? (
|
{searchEnabled && signedIn ? (
|
||||||
<div className='search__popout__menu'>
|
<div className='search__popout__menu'>
|
||||||
{this.defaultOptions.map(({ key, label, action }, i) => (
|
{this.defaultOptions.map(({ key, label, action }, i) => (
|
||||||
<button key={key} onMouseDown={action} className={classNames('search__popout__menu__item', { selected: selectedOption === ((options.length || recent.size) + i) })}>
|
<button key={key} onMouseDown={action} className={classNames('search__popout__menu__item', { selected: selectedOption === ((options.length || recent.size) + i) })}>
|
||||||
|
@ -382,7 +383,11 @@ class Search extends PureComponent {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className='search__popout__menu__message'>
|
<div className='search__popout__menu__message'>
|
||||||
<FormattedMessage id='search_popout.full_text_search_disabled_message' defaultMessage='Not available on {domain}.' values={{ domain }} />
|
{searchEnabled ? (
|
||||||
|
<FormattedMessage id='search_popout.full_text_search_logged_out_message' defaultMessage='Only available when logged in.' />
|
||||||
|
) : (
|
||||||
|
<FormattedMessage id='search_popout.full_text_search_disabled_message' defaultMessage='Not available on {domain}.' values={{ domain }} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue