From 7789beec6496e5e60338ca5456ed5efabea7c90e Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Tue, 23 Oct 2018 14:11:30 -0700 Subject: [PATCH 1/3] Calculate warning properly for all methods of attachment download --- ts/components/conversation/Message.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index a7812a749..2e49ca98d 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -819,6 +819,8 @@ export class Message extends React.Component { } = this.props; const showRetry = status === 'error' && direction === 'outgoing'; + const fileName = attachment ? attachment.fileName : null; + const isDangerous = isFileDangerous(fileName || ''); return ( @@ -827,7 +829,11 @@ export class Message extends React.Component { attributes={{ className: 'module-message__context__download', }} - onClick={onDownload} + onClick={() => { + if (onDownload) { + onDownload(isDangerous); + } + }} > {i18n('downloadAttachment')} From 1e562c82933ed8f44190f7dfc8cec3e5320bd18d Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 24 Oct 2018 11:31:01 -0700 Subject: [PATCH 2/3] Properly handle avatar changes in group update messages --- js/models/messages.js | 25 +++++++++++++++++++++---- js/modules/signal.js | 4 ++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/js/models/messages.js b/js/models/messages.js index 2beca3b94..149e9362c 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -19,10 +19,12 @@ const { Message: TypedMessage, Contact, PhoneNumber } = Signal.Types; const { + deleteAttachmentData, deleteExternalMessageFiles, getAbsoluteAttachmentPath, loadAttachmentData, loadQuoteData, + writeNewAttachmentData, } = window.Signal.Migrations; window.AccountCache = Object.create(null); @@ -1033,28 +1035,43 @@ return conversation.queueJob(async () => { try { const now = new Date().getTime(); - let attributes = { type: 'private' }; + let attributes = { + ...conversation.attributes, + }; if (dataMessage.group) { let groupUpdate = null; attributes = { + ...attributes, type: 'group', groupId: dataMessage.group.id, }; if (dataMessage.group.type === GROUP_TYPES.UPDATE) { attributes = { - type: 'group', - groupId: dataMessage.group.id, + ...attributes, name: dataMessage.group.name, - avatar: dataMessage.group.avatar, members: _.union( dataMessage.group.members, conversation.get('members') ), }; + + // Update this group conversations's avatar on disk if it has changed. + if (dataMessage.group.avatar) { + attributes = await window.Signal.Types.Conversation.maybeUpdateAvatar( + attributes, + dataMessage.group.avatar.data, + { + writeNewAttachmentData, + deleteAttachmentData, + } + ); + } + groupUpdate = conversation.changedAttributes( _.pick(dataMessage.group, 'name', 'avatar') ) || {}; + const difference = _.difference( attributes.members, conversation.get('members') diff --git a/js/modules/signal.js b/js/modules/signal.js index fcc4d022d..0bf5ef297 100644 --- a/js/modules/signal.js +++ b/js/modules/signal.js @@ -119,6 +119,7 @@ function initializeMigrations({ return { attachmentsPath, + deleteAttachmentData: deleteOnDisk, deleteExternalMessageFiles: MessageType.deleteAllExternalFiles({ deleteAttachmentData: Type.deleteData(deleteOnDisk), deleteOnDisk, @@ -131,8 +132,6 @@ function initializeMigrations({ loadMessage: MessageType.createAttachmentLoader(loadAttachmentData), Migrations0DatabaseWithAttachmentData, Migrations1DatabaseWithoutAttachmentData, - writeNewAttachmentData: createWriterForNew(attachmentsPath), - deleteAttachmentData: deleteOnDisk, upgradeMessageSchema: (message, options = {}) => { const { maxVersion } = options; @@ -153,6 +152,7 @@ function initializeMigrations({ writeExistingAttachmentData: createWriterForExisting(attachmentsPath), logger, }), + writeNewAttachmentData: createWriterForNew(attachmentsPath), }; } From ad6f7f35a4819b3b5ffe13330fa3563208462556 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Wed, 24 Oct 2018 15:19:28 -0700 Subject: [PATCH 3/3] v1.17.1-beta.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 73fd81a2e..9c1d57a95 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "Signal", "description": "Private messaging from your desktop", "repository": "https://github.com/signalapp/Signal-Desktop.git", - "version": "1.17.0-beta.4", + "version": "1.17.1-beta.1", "license": "GPL-3.0", "author": { "name": "Open Whisper Systems",