mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Rename writeAttachmentData to writeNewAttachmentData
This commit is contained in:
@@ -7,15 +7,15 @@ const {
|
||||
|
||||
|
||||
// type Context :: {
|
||||
// writeAttachmentData :: ArrayBuffer -> Promise (IO Path)
|
||||
// writeNewAttachmentData :: ArrayBuffer -> Promise (IO Path)
|
||||
// }
|
||||
//
|
||||
// migrateDataToFileSystem :: Attachment ->
|
||||
// Context ->
|
||||
// Promise Attachment
|
||||
exports.migrateDataToFileSystem = async (attachment, { writeAttachmentData } = {}) => {
|
||||
if (!isFunction(writeAttachmentData)) {
|
||||
throw new TypeError('"writeAttachmentData" must be a function');
|
||||
exports.migrateDataToFileSystem = async (attachment, { writeNewAttachmentData } = {}) => {
|
||||
if (!isFunction(writeNewAttachmentData)) {
|
||||
throw new TypeError('"writeNewAttachmentData" must be a function');
|
||||
}
|
||||
|
||||
const { data } = attachment;
|
||||
@@ -32,7 +32,7 @@ exports.migrateDataToFileSystem = async (attachment, { writeAttachmentData } = {
|
||||
` got: ${typeof attachment.data}`);
|
||||
}
|
||||
|
||||
const path = await writeAttachmentData(data);
|
||||
const path = await writeNewAttachmentData(data);
|
||||
|
||||
const attachmentWithoutData = omit(
|
||||
Object.assign({}, attachment, { path }),
|
||||
|
||||
@@ -166,13 +166,13 @@ const toVersion3 = exports._withSchemaVersion(
|
||||
);
|
||||
|
||||
// UpgradeStep
|
||||
exports.upgradeSchema = async (message, { writeAttachmentData } = {}) => {
|
||||
if (!isFunction(writeAttachmentData)) {
|
||||
throw new TypeError('`context.writeAttachmentData` is required');
|
||||
exports.upgradeSchema = async (message, { writeNewAttachmentData } = {}) => {
|
||||
if (!isFunction(writeNewAttachmentData)) {
|
||||
throw new TypeError('`context.writeNewAttachmentData` is required');
|
||||
}
|
||||
|
||||
return toVersion3(
|
||||
await toVersion2(await toVersion1(await toVersion0(message))),
|
||||
{ writeAttachmentData }
|
||||
{ writeNewAttachmentData }
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user