Upgrade Prettier to 2.4.1

This commit is contained in:
Evan Hahn 2021-11-11 16:43:05 -06:00 committed by GitHub
parent f204784afe
commit 5619eeca83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
176 changed files with 1961 additions and 2465 deletions

View file

@ -16,11 +16,10 @@
window.SignalContext.log.info(
'eraseTapToViewMessages: Loading messages...'
);
const messages = await window.Signal.Data.getTapToViewMessagesNeedingErase(
{
const messages =
await window.Signal.Data.getTapToViewMessagesNeedingErase({
MessageCollection: Whisper.MessageCollection,
}
);
});
await Promise.all(
messages.map(async fromDB => {
@ -51,7 +50,8 @@
const HOUR = 60 * MINUTE;
const THIRTY_DAYS = 30 * 24 * HOUR;
const receivedAt = await window.Signal.Data.getNextTapToViewMessageTimestampToAgeOut();
const receivedAt =
await window.Signal.Data.getNextTapToViewMessageTimestampToAgeOut();
if (!receivedAt) {
return;
}

View file

@ -196,9 +196,8 @@ function initializeMigrations({
const getAbsoluteAttachmentPath = createAbsolutePathGetter(attachmentsPath);
const deleteOnDisk = Attachments.createDeleter(attachmentsPath);
const writeNewAttachmentData = createWriterForNew(attachmentsPath);
const copyIntoAttachmentsDirectory = Attachments.copyIntoAttachmentsDirectory(
attachmentsPath
);
const copyIntoAttachmentsDirectory =
Attachments.copyIntoAttachmentsDirectory(attachmentsPath);
const doesAttachmentExist = createDoesExist(attachmentsPath);
const stickersPath = getStickersPath(userDataPath);
@ -216,9 +215,8 @@ function initializeMigrations({
const writeNewTempData = createWriterForNew(tempPath);
const deleteTempFile = Attachments.createDeleter(tempPath);
const readTempData = createReader(tempPath);
const copyIntoTempDirectory = Attachments.copyIntoAttachmentsDirectory(
tempPath
);
const copyIntoTempDirectory =
Attachments.copyIntoAttachmentsDirectory(tempPath);
const draftPath = getDraftPath(userDataPath);
const getAbsoluteDraftPath = createAbsolutePathGetter(draftPath);

View file

@ -194,64 +194,63 @@ exports._mapContact = upgradeContact => async (message, context) => {
// _mapQuotedAttachments :: (QuotedAttachment -> Promise QuotedAttachment) ->
// (Message, Context) ->
// Promise Message
exports._mapQuotedAttachments = upgradeAttachment => async (
message,
context
) => {
if (!message.quote) {
return message;
}
if (!context || !isObject(context.logger)) {
throw new Error('_mapQuotedAttachments: context must have logger object');
}
const upgradeWithContext = async attachment => {
const { thumbnail } = attachment;
if (!thumbnail) {
return attachment;
exports._mapQuotedAttachments =
upgradeAttachment => async (message, context) => {
if (!message.quote) {
return message;
}
if (!context || !isObject(context.logger)) {
throw new Error('_mapQuotedAttachments: context must have logger object');
}
const upgradedThumbnail = await upgradeAttachment(thumbnail, context);
return { ...attachment, thumbnail: upgradedThumbnail };
const upgradeWithContext = async attachment => {
const { thumbnail } = attachment;
if (!thumbnail) {
return attachment;
}
const upgradedThumbnail = await upgradeAttachment(thumbnail, context);
return { ...attachment, thumbnail: upgradedThumbnail };
};
const quotedAttachments =
(message.quote && message.quote.attachments) || [];
const attachments = await Promise.all(
quotedAttachments.map(upgradeWithContext)
);
return { ...message, quote: { ...message.quote, attachments } };
};
const quotedAttachments = (message.quote && message.quote.attachments) || [];
const attachments = await Promise.all(
quotedAttachments.map(upgradeWithContext)
);
return { ...message, quote: { ...message.quote, attachments } };
};
// _mapPreviewAttachments :: (PreviewAttachment -> Promise PreviewAttachment) ->
// (Message, Context) ->
// Promise Message
exports._mapPreviewAttachments = upgradeAttachment => async (
message,
context
) => {
if (!message.preview) {
return message;
}
if (!context || !isObject(context.logger)) {
throw new Error('_mapPreviewAttachments: context must have logger object');
}
const upgradeWithContext = async preview => {
const { image } = preview;
if (!image) {
return preview;
exports._mapPreviewAttachments =
upgradeAttachment => async (message, context) => {
if (!message.preview) {
return message;
}
if (!context || !isObject(context.logger)) {
throw new Error(
'_mapPreviewAttachments: context must have logger object'
);
}
const upgradedImage = await upgradeAttachment(image, context);
return { ...preview, image: upgradedImage };
};
const upgradeWithContext = async preview => {
const { image } = preview;
if (!image) {
return preview;
}
const preview = await Promise.all(
(message.preview || []).map(upgradeWithContext)
);
return { ...message, preview };
};
const upgradedImage = await upgradeAttachment(image, context);
return { ...preview, image: upgradedImage };
};
const preview = await Promise.all(
(message.preview || []).map(upgradeWithContext)
);
return { ...message, preview };
};
const toVersion0 = async (message, context) =>
exports.initializeSchemaVersion({ message, logger: context.logger });

View file

@ -136,5 +136,9 @@
return this;
}
Backbone.Model.prototype.trigger = Backbone.View.prototype.trigger = Backbone.Collection.prototype.trigger = Backbone.Events.trigger = trigger;
Backbone.Model.prototype.trigger =
Backbone.View.prototype.trigger =
Backbone.Collection.prototype.trigger =
Backbone.Events.trigger =
trigger;
})();