Ensure elipsis character always gets added for long questions/answers

This commit is contained in:
Karina Kwiatek 2021-12-25 22:08:06 +01:00
parent fa025ced92
commit 7f26c1fef3
1 changed files with 2 additions and 2 deletions

View File

@ -42,8 +42,8 @@ class Services::Twitter < Service
tweet_text = ""
until parsed_tweet[:valid]
tweet_text = "#{question_content[0..122]}#{'…' if original_question_length > question_content.length}" \
"#{answer_content[0..123]}#{'…' if original_answer_length > answer_content.length} #{answer_url}"
tweet_text = "#{question_content[0..122]}#{'…' if original_question_length > [123, question_content.length].min}" \
"#{answer_content[0..123]}#{'…' if original_answer_length > [124, answer_content.length].min} #{answer_url}"
parsed_tweet = Twitter::TwitterText::Validation::parse_tweet(tweet_text)