mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Ignore synced ephemeral messages & fix expiration updating bug
This commit is contained in:
parent
bb67801c85
commit
45985f4f64
@ -569,8 +569,8 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
|
MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
|
||||||
Recipient recipient = getMessageDestination(content, message);
|
Recipient recipient = getMessageMasterDestination(content.getSender());
|
||||||
IncomingMediaMessage mediaMessage = new IncomingMediaMessage(Address.fromSerialized(content.getSender()),
|
IncomingMediaMessage mediaMessage = new IncomingMediaMessage(getMessageMasterDestination(content.getSender()).getAddress(),
|
||||||
message.getTimestamp(), -1,
|
message.getTimestamp(), -1,
|
||||||
message.getExpiresInSeconds() * 1000L, true,
|
message.getExpiresInSeconds() * 1000L, true,
|
||||||
content.isNeedsReceipt(),
|
content.isNeedsReceipt(),
|
||||||
@ -642,6 +642,8 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
threadId = handleSynchronizeSentTextMessage(message);
|
threadId = handleSynchronizeSentTextMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (threadId == -1L) { threadId = null; }
|
||||||
|
|
||||||
if (message.getMessage().getGroupInfo().isPresent() && groupDatabase.isUnknownGroup(GroupUtil.getEncodedId(message.getMessage().getGroupInfo().get()))) {
|
if (message.getMessage().getGroupInfo().isPresent() && groupDatabase.isUnknownGroup(GroupUtil.getEncodedId(message.getMessage().getGroupInfo().get()))) {
|
||||||
handleUnknownGroupMessage(content, message.getMessage().getGroupInfo().get());
|
handleUnknownGroupMessage(content, message.getMessage().getGroupInfo().get());
|
||||||
}
|
}
|
||||||
@ -766,8 +768,8 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
|
MmsDatabase database = DatabaseFactory.getMmsDatabase(context);
|
||||||
database.beginTransaction();
|
database.beginTransaction();
|
||||||
|
|
||||||
// Ignore message if it has no body and no attachments or anything
|
// Loki - Ignore message if it has no body and no attachments
|
||||||
if (mediaMessage.getBody().isEmpty() && mediaMessage.getAttachments().isEmpty() && mediaMessage.getSharedContacts().isEmpty() && mediaMessage.getLinkPreviews().isEmpty()) {
|
if (mediaMessage.getBody().isEmpty() && mediaMessage.getAttachments().isEmpty() && mediaMessage.getLinkPreviews().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -959,7 +961,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
|
|
||||||
IncomingEncryptedMessage textMessage = new IncomingEncryptedMessage(tm, body);
|
IncomingEncryptedMessage textMessage = new IncomingEncryptedMessage(tm, body);
|
||||||
|
|
||||||
// Ignore the message if the body is empty
|
// Ignore the message if it has no body
|
||||||
if (textMessage.getMessageBody().length() == 0) { return; }
|
if (textMessage.getMessageBody().length() == 0) { return; }
|
||||||
|
|
||||||
// Insert the message into the database
|
// Insert the message into the database
|
||||||
@ -1009,6 +1011,9 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
String body = message.getMessage().getBody().or("");
|
String body = message.getMessage().getBody().or("");
|
||||||
long expiresInMillis = message.getMessage().getExpiresInSeconds() * 1000L;
|
long expiresInMillis = message.getMessage().getExpiresInSeconds() * 1000L;
|
||||||
|
|
||||||
|
// Ignore the message if it has no body
|
||||||
|
if (body.isEmpty()) { return -1; }
|
||||||
|
|
||||||
if (recipient.getExpireMessages() != message.getMessage().getExpiresInSeconds()) {
|
if (recipient.getExpireMessages() != message.getMessage().getExpiresInSeconds()) {
|
||||||
handleSynchronizeSentExpirationUpdate(message);
|
handleSynchronizeSentExpirationUpdate(message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user