X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/67f62947c6d4cc5f4b9d4334bfe55b753bc6a12c..1d2c7a479d791dedde6c2022ac65e9c82400af79:/src/main/java/org/asamk/signal/json/JsonQuote.java diff --git a/src/main/java/org/asamk/signal/json/JsonQuote.java b/src/main/java/org/asamk/signal/json/JsonQuote.java index 10cd0bf4..8165bcfa 100644 --- a/src/main/java/org/asamk/signal/json/JsonQuote.java +++ b/src/main/java/org/asamk/signal/json/JsonQuote.java @@ -1,5 +1,8 @@ package org.asamk.signal.json; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + import org.asamk.signal.manager.Manager; import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage; @@ -9,12 +12,21 @@ import java.util.stream.Collectors; public class JsonQuote { - long id; - String author; - String text; + @JsonProperty + final long id; + + @JsonProperty + final String author; + + @JsonProperty + final String text; - List mentions; - List attachments; + @JsonProperty + @JsonInclude(JsonInclude.Include.NON_NULL) + final List mentions; + + @JsonProperty + final List attachments; JsonQuote(SignalServiceDataMessage.Quote quote, Manager m) { this.id = quote.getId(); @@ -26,6 +38,8 @@ public class JsonQuote { .stream() .map(quotedMention -> new JsonMention(quotedMention, m)) .collect(Collectors.toList()); + } else { + this.mentions = null; } if (quote.getAttachments().size() > 0) {