Improve mentions when splitting toots

This commit is contained in:
tom79 2019-09-14 12:30:16 +02:00
parent 42d45471fc
commit 52605ef877
1 changed files with 8 additions and 7 deletions

View File

@ -3624,11 +3624,6 @@ public class Helper {
ArrayList<String> mentions = new ArrayList<>();
Matcher matcher = mentionLongPattern.matcher(content);
while (matcher.find()) {
String mentionLong = matcher.group(1);
mentions.add(mentionLong);
}
matcher = mentionLongPattern.matcher(content);
while (matcher.find()) {
String mentionLong = matcher.group(1);
if (!mentions.contains(mentionLong)) {
@ -3671,8 +3666,14 @@ public class Helper {
if (reply.size() > 1) {
int i = 0;
for (String r : reply) {
if (mentions.size() > 0) {
reply.set(i, r + " " + mentionString + " - " + (i + 1) + "/" + reply.size());
if (mentions.size() > 0 ) {
String tmpMention = mentionString.toString();
for (String mention : mentions) {
if(r.contains(mention)){
tmpMention = tmpMention.replace(mention,"");
}
}
reply.set(i, r + " " + tmpMention + " - " + (i + 1) + "/" + reply.size());
} else {
reply.set(i, r + " - " + (i + 1) + "/" + reply.size());
}