mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 05:00:53 +08:00
FIX: Failing system spec for rate limited search (#20046)
This commit is contained in:
parent
1856ea83ec
commit
a409924425
@ -159,16 +159,16 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<ConditionalLoadingSpinner @condition={{this.loading}}>
|
<ConditionalLoadingSpinner @condition={{this.loading}}>
|
||||||
|
{{#if this.error}}
|
||||||
|
<div class="warning">
|
||||||
|
{{this.error}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#unless this.hasResults}}
|
{{#unless this.hasResults}}
|
||||||
{{#if this.searchActive}}
|
{{#if this.searchActive}}
|
||||||
<h3>{{i18n "search.no_results"}}</h3>
|
<h3>{{i18n "search.no_results"}}</h3>
|
||||||
|
|
||||||
{{#if this.error}}
|
|
||||||
<div class="warning">
|
|
||||||
{{this.error}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if this.showSuggestion}}
|
{{#if this.showSuggestion}}
|
||||||
<div class="no-results-suggestion">
|
<div class="no-results-suggestion">
|
||||||
{{i18n "search.cant_find"}}
|
{{i18n "search.cant_find"}}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
.warning {
|
.warning {
|
||||||
background-color: var(--danger-medium);
|
background-color: var(--danger-medium);
|
||||||
padding: 5px 8px;
|
padding: 5px 8px;
|
||||||
|
margin-block: 0.5rem;
|
||||||
color: var(--secondary);
|
color: var(--secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,30 +41,14 @@ describe "Search", type: :system, js: true do
|
|||||||
before do
|
before do
|
||||||
SearchIndexer.enable
|
SearchIndexer.enable
|
||||||
SearchIndexer.index(topic, force: true)
|
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
|
RateLimiter.enable
|
||||||
end
|
end
|
||||||
|
|
||||||
after { SearchIndexer.disable }
|
after { SearchIndexer.disable }
|
||||||
|
|
||||||
it "rate limits searches for anonymous users" do
|
it "rate limits searches for anonymous users" do
|
||||||
queries = %w[
|
queries = %w[one two three four]
|
||||||
one
|
|
||||||
two
|
|
||||||
three
|
|
||||||
four
|
|
||||||
five
|
|
||||||
six
|
|
||||||
seven
|
|
||||||
eight
|
|
||||||
nine
|
|
||||||
ten
|
|
||||||
eleven
|
|
||||||
twelve
|
|
||||||
thirteen
|
|
||||||
fourteen
|
|
||||||
fifteen
|
|
||||||
]
|
|
||||||
|
|
||||||
visit("/search?expanded=true")
|
visit("/search?expanded=true")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user