A few bug fixes

This commit is contained in:
Scott Nonnenberg 2021-02-26 07:08:59 -08:00 committed by Josh Perez
parent 4b28fd896a
commit 2aa2aca9f2
6 changed files with 76 additions and 27 deletions

View file

@ -11542,9 +11542,6 @@ $contact-modal-padding: 18px;
// To limit messages with things forcing them wider, like long attachment names // To limit messages with things forcing them wider, like long attachment names
.module-message__container { .module-message__container {
// 2px to allow for 1px border
max-width: 302px;
&--incoming { &--incoming {
align-self: flex-start; align-self: flex-start;
} }
@ -11679,15 +11676,20 @@ $contact-modal-padding: 18px;
} }
} }
/* Spec: container < 437px */
@media (min-width: 0px) and (max-width: 799px) {
.module-message {
// Add 2px for 1px border
max-width: 302px;
}
}
/* Spec: container > 438px and container < 593px */ /* Spec: container > 438px and container < 593px */
@media (min-width: 800px) and (max-width: 925px) { @media (min-width: 800px) and (max-width: 925px) {
.module-message { .module-message {
// Add 2px for 1px border // Add 2px for 1px border
max-width: 376px; max-width: 376px;
} }
.module-message__container {
max-width: 100%;
}
// Spec: container < 438px // Spec: container < 438px
.module-message--incoming { .module-message--incoming {
@ -11722,9 +11724,6 @@ $contact-modal-padding: 18px;
.module-message { .module-message {
max-width: 66%; max-width: 66%;
} }
.module-message__container {
max-width: 100%;
}
.module-message--incoming { .module-message--incoming {
margin-right: auto; margin-right: auto;

View file

@ -626,7 +626,17 @@ type WhatIsThis = import('./window.d').WhatIsThis;
Views.Initialization.setMessage(window.i18n('optimizingApplication')); Views.Initialization.setMessage(window.i18n('optimizingApplication'));
if (newVersion) { if (newVersion) {
// We've received reports that this update can take longer than two minutes, so we
// allow it to continue and just move on in that timeout case.
try {
await window.Signal.Data.cleanupOrphanedAttachments(); await window.Signal.Data.cleanupOrphanedAttachments();
} catch (error) {
window.log.error(
'background: Failed to cleanup orphaned attachments:',
error && error.stack ? error.stack : error
);
}
// Don't block on the following operation // Don't block on the following operation
window.Signal.Data.ensureFilePermissions(); window.Signal.Data.ensureFilePermissions();
} }

View file

@ -755,6 +755,23 @@ story.add('Other File Type with Caption', () => {
return renderBothDirections(props); return renderBothDirections(props);
}); });
story.add('Other File Type with Long Filename', () => {
const props = createProps({
attachments: [
{
contentType: 'text/plain' as MIMEType,
fileName:
'INSERT-APP-NAME_INSERT-APP-APPLE-ID_AppStore_AppsGamesWatch.psd.zip',
url: 'a2/a2334324darewer4234',
},
],
status: 'sent',
text: 'This is what I have done.',
});
return renderBothDirections(props);
});
story.add('TapToView Image', () => { story.add('TapToView Image', () => {
const props = createProps({ const props = createProps({
attachments: [ attachments: [

View file

@ -2803,11 +2803,7 @@ export class ConversationModel extends window.Backbone.Model<
return Promise.all( return Promise.all(
attachments attachments
.filter( .filter(
attachment => attachment => attachment && !attachment.pending && !attachment.error
attachment &&
attachment.contentType &&
!attachment.pending &&
!attachment.error
) )
.slice(0, 1) .slice(0, 1)
.map(async attachment => { .map(async attachment => {

View file

@ -424,7 +424,7 @@ export const getConversationSelector = createSelector(
if (onE164) { if (onE164) {
return selector(onE164); return selector(onE164);
} }
const onUuid = getOwn(byUuid, id); const onUuid = getOwn(byUuid, id.toLowerCase ? id.toLowerCase() : id);
if (onUuid) { if (onUuid) {
return selector(onUuid); return selector(onUuid);
} }

View file

@ -1372,8 +1372,15 @@ Whisper.ConversationView = Whisper.View.extend({
const { files } = e.originalEvent.dataTransfer; const { files } = e.originalEvent.dataTransfer;
for (let i = 0, max = files.length; i < max; i += 1) { for (let i = 0, max = files.length; i < max; i += 1) {
const file = files[i]; const file = files[i];
try {
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
await this.maybeAddAttachment(file); await this.maybeAddAttachment(file);
} catch (error) {
window.log.error(
'ConversationView/onDrop: Failed to add attachment:',
error && error.stack ? error.stack : error
);
}
} }
}, },
@ -1399,12 +1406,23 @@ Whisper.ConversationView = Whisper.View.extend({
return { return {
// In conversation model/redux // In conversation model/redux
attachments: draftAttachments.map((attachment: any) => ({ attachments: draftAttachments.map((attachment: any) => {
let url = '';
if (attachment.screenshotPath) {
url = getAbsoluteDraftPath(attachment.screenshotPath);
} else if (attachment.path) {
url = getAbsoluteDraftPath(attachment.path);
} else {
window.log.warn(
'getPropsForAttachmentList: Attachment was missing both screenshotPath and path fields'
);
}
return {
...attachment, ...attachment,
url: attachment.screenshotPath url,
? getAbsoluteDraftPath(attachment.screenshotPath) };
: getAbsoluteDraftPath(attachment.path), }),
})),
// Passed in from ConversationView // Passed in from ConversationView
onAddAttachment: this.onChooseAttachment.bind(this), onAddAttachment: this.onChooseAttachment.bind(this),
onClickAttachment: this.onClickAttachment.bind(this), onClickAttachment: this.onClickAttachment.bind(this),
@ -1479,9 +1497,9 @@ Whisper.ConversationView = Whisper.View.extend({
draftAttachments: [...draftAttachments, onDisk], draftAttachments: [...draftAttachments, onDisk],
draftChanged: true, draftChanged: true,
}); });
await this.saveModel();
this.updateAttachmentsView(); this.updateAttachmentsView();
await this.saveModel();
}, },
async onCloseAttachment(attachment: any) { async onCloseAttachment(attachment: any) {
@ -1701,7 +1719,16 @@ Whisper.ConversationView = Whisper.View.extend({
return; return;
} }
try {
await this.addAttachment(attachment); await this.addAttachment(attachment);
} catch (error) {
window.log.error(
'Error saving draft attachment:',
error && error.stack ? error.stack : error
);
this.showToast(Whisper.UnableToLoadToast);
}
}, },
isSizeOkay(attachment: any) { isSizeOkay(attachment: any) {