Added improvements to tweet condense feature

This commit is contained in:
Manuel Cortez 2021-08-31 10:05:21 -05:00
parent c7b6d69518
commit a9a4189295

View File

@ -254,10 +254,10 @@ def clean_mentions(text):
total_users = 0
for user in mentionned_people:
if abs(user.start()-end) < 3:
new_text = new_text.replace(user.group(0), "")
new_text = new_text.replace(user.group(0), "", 1)
total_users = total_users+1
end = user.end()
if total_users < 1:
if total_users-2 < 1:
return text
new_text = _("{user_1}, {user_2} and {all_users} more: {text}").format(user_1=mentionned_people[0].group(0), user_2=mentionned_people[1].group(0), all_users=total_users-2, text=new_text)
return new_text