mirror of
https://github.com/discourse/discourse.git
synced 2025-03-09 14:34:35 +00:00
Convert to link as long as a valid link is received.
This commit is contained in:
parent
190345ba20
commit
e8c5127865
@ -14,8 +14,8 @@ Discourse.Dialect.inlineRegexp({
|
|||||||
categoryHashtagLookup = this.dialect.options.categoryHashtagLookup,
|
categoryHashtagLookup = this.dialect.options.categoryHashtagLookup,
|
||||||
result = categoryHashtagLookup && categoryHashtagLookup(slug);
|
result = categoryHashtagLookup && categoryHashtagLookup(slug);
|
||||||
|
|
||||||
if (result && result[0] === "category") {
|
if (result) {
|
||||||
return ['a', { class: attributeClass, href: result[1] }, '#', ["span", {}, slug]];
|
return ['a', { class: attributeClass, href: result }, '#', ["span", {}, slug]];
|
||||||
} else {
|
} else {
|
||||||
return ['span', { class: attributeClass }, hashtag];
|
return ['span', { class: attributeClass }, hashtag];
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ module PrettyText
|
|||||||
|
|
||||||
def category_hashtag_lookup(category_slug)
|
def category_hashtag_lookup(category_slug)
|
||||||
if category = Category.query_from_hashtag_slug(category_slug)
|
if category = Category.query_from_hashtag_slug(category_slug)
|
||||||
['category', category.url_with_id]
|
category.url_with_id
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user