FIX: Failing system spec for rate limited search (#20046)

This commit is contained in:
Keegan George 2023-01-27 12:14:29 -08:00 committed by GitHub
parent 39eec37e75
commit a4c68d4a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 24 deletions

View File

@ -159,16 +159,16 @@
/>
<ConditionalLoadingSpinner @condition={{this.loading}}>
{{#unless this.hasResults}}
{{#if this.searchActive}}
<h3>{{i18n "search.no_results"}}</h3>
{{#if this.error}}
<div class="warning">
{{this.error}}
</div>
{{/if}}
{{#unless this.hasResults}}
{{#if this.searchActive}}
<h3>{{i18n "search.no_results"}}</h3>
{{#if this.showSuggestion}}
<div class="no-results-suggestion">
{{i18n "search.cant_find"}}

View File

@ -18,6 +18,7 @@
.warning {
background-color: var(--danger-medium);
padding: 5px 8px;
margin-block: 0.5rem;
color: var(--secondary);
}

View File

@ -41,30 +41,14 @@ describe "Search", type: :system, js: true do
before do
SearchIndexer.enable
SearchIndexer.index(topic, force: true)
SiteSetting.rate_limit_search_anon_user_per_minute = 15
SiteSetting.rate_limit_search_anon_user_per_minute = 4
RateLimiter.enable
end
after { SearchIndexer.disable }
it "rate limits searches for anonymous users" do
queries = %w[
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
]
queries = %w[one two three four]
visit("/search?expanded=true")