Keep order of labels

This commit is contained in:
Christian Basler 2017-03-30 16:31:36 +02:00
parent 3ab3d7a0ca
commit 5849e68d20
2 changed files with 6 additions and 6 deletions

View File

@ -543,7 +543,7 @@ public class Plaintext implements Streamable {
private long sent;
private Long received;
private Status status;
private Set<Label> labels = new HashSet<>();
private Set<Label> labels = new LinkedHashSet<>();
private long ttl;
private int retries;
private Long nextTry;

View File

@ -205,11 +205,11 @@ public class JdbcMessageRepository extends AbstractMessageRepository implements
byte[] childIV = message.getInventoryVector().getHash();
// save new parents
int order = 0;
try (PreparedStatement ps = connection.prepareStatement("INSERT INTO Message_Parent VALUES (?, ?, ?, ?)")) {
for (InventoryVector parentIV : message.getParents()) {
Plaintext parent = getMessage(parentIV);
mergeConversations(connection, parent.getConversationId(), message.getConversationId());
order++;
try (PreparedStatement ps = connection.prepareStatement("INSERT INTO Message_Parent VALUES (?, ?, ?, ?)")) {
ps.setBytes(1, parentIV.getHash());
ps.setBytes(2, childIV);
ps.setInt(3, order); // FIXME: this might not be necessary