mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-24 07:43:24 +00:00
Validation of count works even when text of status is nil (#6429)
This commit is contained in:
parent
3f35d43222
commit
9b6223f5e2
|
@ -23,6 +23,8 @@ class StatusLengthValidator < ActiveModel::Validator
|
||||||
end
|
end
|
||||||
|
|
||||||
def countable_text(status)
|
def countable_text(status)
|
||||||
|
return '' if status.text.nil?
|
||||||
|
|
||||||
status.text.dup.tap do |new_text|
|
status.text.dup.tap do |new_text|
|
||||||
new_text.gsub!(FetchLinkCardService::URL_PATTERN, 'x' * 23)
|
new_text.gsub!(FetchLinkCardService::URL_PATTERN, 'x' * 23)
|
||||||
new_text.gsub!(Account::MENTION_RE, '@\2')
|
new_text.gsub!(Account::MENTION_RE, '@\2')
|
||||||
|
|
Loading…
Reference in a new issue