mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: Hashtag error in PrettyText when processing email (#22680)
Followup tob583872eed
and54001060ea
Another place where we need to filter hashtag types to only enabled ones is PrettyText, though the latter PR above should also already make it so the correct priority types are passed. This is causing errors in the email processing workflow for some customers (presumably ones with tagging disabled).
This commit is contained in:
parent
7cee80d699
commit
3be9e6c97e
|
@ -125,6 +125,11 @@ module PrettyText
|
|||
cooking_user = User.find(cooking_user_id)
|
||||
end
|
||||
|
||||
types_in_priority_order =
|
||||
types_in_priority_order.select do |type|
|
||||
HashtagAutocompleteService.data_source_types.include?(type)
|
||||
end
|
||||
|
||||
result =
|
||||
HashtagAutocompleteService.new(Guardian.new(cooking_user)).lookup(
|
||||
[slug],
|
||||
|
|
|
@ -163,6 +163,13 @@ RSpec.describe PrettyText::Helpers do
|
|||
)
|
||||
end
|
||||
|
||||
it "does not return any results for disabled types" do
|
||||
SiteSetting.tagging_enabled = false
|
||||
expect(
|
||||
PrettyText::Helpers.hashtag_lookup("somecooltag::tag", user.id, %w[category tag]),
|
||||
).to eq(nil)
|
||||
end
|
||||
|
||||
it "returns nil when no tag or category that matches exists" do
|
||||
expect(PrettyText::Helpers.hashtag_lookup("blah", user.id, %w[category tag])).to eq(nil)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user