mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 22:37:37 +08:00
DEV: Remove enable_experimental_hashtag_autocomplete logic (#22820)
This commit removes any logic in the app and in specs around enable_experimental_hashtag_autocomplete and deletes some old category hashtag code that is no longer necessary. It also adds a `slug_ref` category instance method, which will generate a reference like `parent:child` for a category, with an optional depth, which hashtags use. Also refactors PostRevisor which was using CategoryHashtagDataSource directly which is a no-no. Deletes the old hashtag markdown rule as well.
This commit is contained in:
@ -96,21 +96,6 @@ module PrettyText
|
||||
end
|
||||
end
|
||||
|
||||
# TODO (martin) Remove this when everything is using hashtag_lookup
|
||||
# after enable_experimental_hashtag_autocomplete is default.
|
||||
def category_tag_hashtag_lookup(text)
|
||||
is_tag = text =~ /#{TAG_HASHTAG_POSTFIX}\z/
|
||||
|
||||
if !is_tag && category = Category.query_from_hashtag_slug(text)
|
||||
[category.url, text]
|
||||
elsif (!is_tag && tag = Tag.find_by(name: text)) ||
|
||||
(is_tag && tag = Tag.find_by(name: text.gsub!(TAG_HASHTAG_POSTFIX, "")))
|
||||
[tag.url, text]
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def hashtag_lookup(slug, cooking_user_id, types_in_priority_order)
|
||||
# NOTE: This is _somewhat_ expected since we need to be able to cook posts
|
||||
# etc. without a user sometimes, but it is still an edge case.
|
||||
|
Reference in New Issue
Block a user