From d03453654ebfe70c5e9d8f27106da2c2c8821a5c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 3 Nov 2018 13:21:51 +0300 Subject: Fix modification of immutable list --- .../main/java/com/juick/server/ActivityPubManager.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'juick-server/src') diff --git a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java index 6f5163cc..4601f7d1 100644 --- a/juick-server/src/main/java/com/juick/server/ActivityPubManager.java +++ b/juick-server/src/main/java/com/juick/server/ActivityPubManager.java @@ -4,11 +4,15 @@ import com.juick.Message; import com.juick.User; import com.juick.formatters.PlainTextFormatter; import com.juick.server.api.activity.model.Context; -import com.juick.server.api.activity.model.objects.*; import com.juick.server.api.activity.model.activities.Accept; import com.juick.server.api.activity.model.activities.Announce; import com.juick.server.api.activity.model.activities.Create; import com.juick.server.api.activity.model.activities.Delete; +import com.juick.server.api.activity.model.objects.Hashtag; +import com.juick.server.api.activity.model.objects.Image; +import com.juick.server.api.activity.model.objects.Mention; +import com.juick.server.api.activity.model.objects.Note; +import com.juick.server.api.activity.model.objects.Person; import com.juick.server.util.HttpUtils; import com.juick.service.SocialService; import com.juick.service.UserService; @@ -17,17 +21,11 @@ import com.juick.service.component.*; import com.juick.util.MessageUtils; import com.mitchellbosecke.pebble.PebbleEngine; import com.mitchellbosecke.pebble.template.PebbleTemplate; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.client.ClientHttpResponse; import org.springframework.stereotype.Component; -import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.util.UriComponentsBuilder; import javax.annotation.Nonnull; @@ -37,7 +35,6 @@ import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.net.URI; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -268,7 +265,9 @@ public class ActivityPubManager implements ActivityListener, NotificationListene if (personContext.isPresent()) { Person person = (Person) personContext.get(); note.getTags().add(new Mention(person.getUrl(), person.getPreferredUsername())); - note.getCc().add(person.getUrl()); + List cc = new ArrayList<>(note.getCc()); + cc.add(person.getUrl()); + note.setCc(cc); } }); if (msg.isHtml()) { -- cgit v1.2.3