DEV: Remove old link building code. (#16121)

We have a new API introduced [here](https://github.com/discourse/discourse/pull/14553).
This commit is contained in:
Roman Rizzi 2022-03-25 09:36:39 -03:00 committed by GitHub
parent 76ece494f9
commit 136f7dbf78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 17 deletions

View File

@ -40,12 +40,6 @@ class ReviewableScoreSerializer < ApplicationSerializer
text = I18n.t("reviewables.reasons.#{object.reason}", link: link, default: nil) text = I18n.t("reviewables.reasons.#{object.reason}", link: link, default: nil)
else else
text = I18n.t("reviewables.reasons.#{object.reason}", default: nil) text = I18n.t("reviewables.reasons.#{object.reason}", default: nil)
# TODO(roman): Remove after the 2.8 release.
# The discourse-antivirus and akismet plugins still use the backtick format for settings.
# It'll be hard to migrate them to the new format without breaking backwards compatibility, so I'm keeping the old behavior for now.
# Will remove after the 2.8 release.
linkify_backticks(object.reason, text) if text
end end
text text
@ -86,15 +80,4 @@ class ReviewableScoreSerializer < ApplicationSerializer
"<a href=\"#{url_for(reason, text)}\">#{text.gsub('_', ' ')}</a>" "<a href=\"#{url_for(reason, text)}\">#{text.gsub('_', ' ')}</a>"
end end
def linkify_backticks(reason, text)
text.gsub!(/`[a-z_]+`/) do |m|
if scope.is_staff?
setting = m[1..-2]
"<a href=\"#{url_for(reason, setting)}\">#{setting.gsub('_', ' ')}</a>"
else
m.gsub('_', ' ')
end
end
end
end end