Merge branch 'master' into development

This commit is contained in:
Scott Nonnenberg 2018-02-28 18:52:22 -08:00
commit ed4ef181af
No known key found for this signature in database
GPG key ID: A4931C09644C654B
4 changed files with 53 additions and 19 deletions

View file

@ -438,17 +438,24 @@
color: details.color, color: details.color,
active_at: activeAt, active_at: activeAt,
})).then(function() { })).then(function() {
// this needs to be inline to get access to conversation model const { expireTimer } = details;
if (typeof details.expireTimer !== 'undefined') { const isValidExpireTimer = typeof expireTimer === 'number';
var source = textsecure.storage.user.getNumber(); if (!isValidExpireTimer) {
var receivedAt = Date.now(); console.log(
return conversation.updateExpirationTimer( 'Ignore invalid expire timer.',
details.expireTimer, 'Expected numeric `expireTimer`, got:', expireTimer
source,
receivedAt,
{fromSync: true}
); );
return;
} }
var source = textsecure.storage.user.getNumber();
var receivedAt = Date.now();
return conversation.updateExpirationTimer(
expireTimer,
source,
receivedAt,
{fromSync: true}
);
}); });
}) })
.then(function() { .then(function() {
@ -498,16 +505,24 @@
} }
return wrapDeferred(conversation.save(updates)).then(function() { return wrapDeferred(conversation.save(updates)).then(function() {
if (typeof details.expireTimer !== 'undefined') { const { expireTimer } = details;
var source = textsecure.storage.user.getNumber(); const isValidExpireTimer = typeof expireTimer === 'number';
var receivedAt = Date.now(); if (!isValidExpireTimer) {
return conversation.updateExpirationTimer( console.log(
details.expireTimer, 'Ignore invalid expire timer.',
source, 'Expected numeric `expireTimer`, got:', expireTimer
receivedAt,
{fromSync: true}
); );
return;
} }
var source = textsecure.storage.user.getNumber();
var receivedAt = Date.now();
return conversation.updateExpirationTimer(
expireTimer,
source,
receivedAt,
{fromSync: true}
);
}).then(ev.confirm); }).then(ev.confirm);
}); });
} }

View file

@ -675,7 +675,9 @@
return collection.fetchConversation(this.id, 1).then(function() { return collection.fetchConversation(this.id, 1).then(function() {
var lastMessage = collection.at(0); var lastMessage = collection.at(0);
if (lastMessage) { if (lastMessage) {
if (lastMessage.get('type') === 'verified-change') { var type = lastMessage.get('type');
var shouldSkipUpdate = type === 'verified-change' || lastMessage.get('expirationTimerUpdate');
if (shouldSkipUpdate) {
return; return;
} }
this.set({ this.set({
@ -707,6 +709,8 @@
console.log( console.log(
'Updating expireTimer for conversation', 'Updating expireTimer for conversation',
this.idForLogging(), this.idForLogging(),
'to',
expireTimer,
'via', 'via',
source source
); );

View file

@ -457,6 +457,21 @@
message.set({expireTimer: dataMessage.expireTimer}); 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 (!message.isEndSession() && !message.isGroupUpdate()) {
if (dataMessage.expireTimer) { if (dataMessage.expireTimer) {
if (dataMessage.expireTimer !== conversation.get('expireTimer')) { if (dataMessage.expireTimer !== conversation.get('expireTimer')) {

View file

@ -3,7 +3,7 @@
"productName": "Signal", "productName": "Signal",
"description": "Private messaging from your desktop", "description": "Private messaging from your desktop",
"repository": "https://github.com/signalapp/Signal-Desktop.git", "repository": "https://github.com/signalapp/Signal-Desktop.git",
"version": "1.5.0-beta.1", "version": "1.5.1",
"license": "GPL-3.0", "license": "GPL-3.0",
"author": { "author": {
"name": "Open Whisper Systems", "name": "Open Whisper Systems",