Hotfix: Ignore iOS group expire timer sync resets (#2086)
Hotfix: Ignore invalid expire timer sync resets iOS omits `expireTimer` protobuf property to denote disappearing messages have been turned off. However, that doesn’t allow us to distinguish it from old clients that are not aware of this property. This change ignores these invalid values until we consistently use `0` to denote disabled disappearing messages (as Android does). - [x] Ignore non-numeric `expireTimer` values during contact sync. Long-term, we’ll use `0` to denote turning off expire timers. - [x] Log what value `expireTimer` is set to. - [x] Log changes to `expireTimer` in `handleDataMessage` until it uses `ConversationController::updateExpirationTimer`.
This commit is contained in:
parent
65787918bc
commit
caa579f3b8
3 changed files with 49 additions and 17 deletions
|
@ -438,17 +438,24 @@
|
|||
color: details.color,
|
||||
active_at: activeAt,
|
||||
})).then(function() {
|
||||
// this needs to be inline to get access to conversation model
|
||||
if (typeof details.expireTimer !== 'undefined') {
|
||||
var source = textsecure.storage.user.getNumber();
|
||||
var receivedAt = Date.now();
|
||||
return conversation.updateExpirationTimer(
|
||||
details.expireTimer,
|
||||
source,
|
||||
receivedAt,
|
||||
{fromSync: true}
|
||||
const { expireTimer } = details;
|
||||
const isValidExpireTimer = typeof expireTimer === 'number';
|
||||
if (!isValidExpireTimer) {
|
||||
console.log(
|
||||
'Ignore invalid expire timer.',
|
||||
'Expected numeric `expireTimer`, got:', expireTimer
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var source = textsecure.storage.user.getNumber();
|
||||
var receivedAt = Date.now();
|
||||
return conversation.updateExpirationTimer(
|
||||
expireTimer,
|
||||
source,
|
||||
receivedAt,
|
||||
{fromSync: true}
|
||||
);
|
||||
});
|
||||
})
|
||||
.then(function() {
|
||||
|
@ -498,16 +505,24 @@
|
|||
}
|
||||
|
||||
return wrapDeferred(conversation.save(updates)).then(function() {
|
||||
if (typeof details.expireTimer !== 'undefined') {
|
||||
var source = textsecure.storage.user.getNumber();
|
||||
var receivedAt = Date.now();
|
||||
return conversation.updateExpirationTimer(
|
||||
details.expireTimer,
|
||||
source,
|
||||
receivedAt,
|
||||
{fromSync: true}
|
||||
const { expireTimer } = details;
|
||||
const isValidExpireTimer = typeof expireTimer === 'number';
|
||||
if (!isValidExpireTimer) {
|
||||
console.log(
|
||||
'Ignore invalid expire timer.',
|
||||
'Expected numeric `expireTimer`, got:', expireTimer
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var source = textsecure.storage.user.getNumber();
|
||||
var receivedAt = Date.now();
|
||||
return conversation.updateExpirationTimer(
|
||||
expireTimer,
|
||||
source,
|
||||
receivedAt,
|
||||
{fromSync: true}
|
||||
);
|
||||
}).then(ev.confirm);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -707,6 +707,8 @@
|
|||
console.log(
|
||||
'Updating expireTimer for conversation',
|
||||
this.idForLogging(),
|
||||
'to',
|
||||
expireTimer,
|
||||
'via',
|
||||
source
|
||||
);
|
||||
|
|
|
@ -457,6 +457,21 @@
|
|||
message.set({expireTimer: dataMessage.expireTimer});
|
||||
}
|
||||
|
||||
// NOTE: Remove once the above uses
|
||||
// `Conversation::updateExpirationTimer`:
|
||||
const { expireTimer } = dataMessage;
|
||||
const shouldLogExpireTimerChange =
|
||||
message.isExpirationTimerUpdate() || expireTimer;
|
||||
if (shouldLogExpireTimerChange) {
|
||||
console.log(
|
||||
'Updating expireTimer for conversation',
|
||||
conversation.idForLogging(),
|
||||
'to',
|
||||
expireTimer,
|
||||
'via `handleDataMessage`'
|
||||
);
|
||||
}
|
||||
|
||||
if (!message.isEndSession() && !message.isGroupUpdate()) {
|
||||
if (dataMessage.expireTimer) {
|
||||
if (dataMessage.expireTimer !== conversation.get('expireTimer')) {
|
||||
|
|
Loading…
Reference in a new issue