From ebf7fb1a043932dc66b6a4c0ab8b7cd47bfbfb6d Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Wed, 19 Jul 2023 09:56:16 -0700 Subject: [PATCH] fix: :bug: gitignore causing wrong file to be pushed --- .gitignore | 1 + .../processors/db/import-calckey-post.ts | 68 ------------------- 2 files changed, 1 insertion(+), 68 deletions(-) delete mode 100644 packages/backend/src/queue/processors/db/import-calckey-post.ts diff --git a/.gitignore b/.gitignore index ce9e4f8a1e..ad887b7e2a 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ packages/backend/assets/instance.css packages/backend/assets/sounds/None.mp3 packages/backend/assets/LICENSE +!/packages/backend/queue/processors/db !packages/backend/src/db packages/megalodon/lib diff --git a/packages/backend/src/queue/processors/db/import-calckey-post.ts b/packages/backend/src/queue/processors/db/import-calckey-post.ts deleted file mode 100644 index 945c50d637..0000000000 --- a/packages/backend/src/queue/processors/db/import-calckey-post.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as Post from "@/misc/post.js"; -import create from "@/services/note/create.js"; -import { Users } from "@/models/index.js"; -import type { DbUserImportMastoPostJobData } from "@/queue/types.js"; -import { queueLogger } from "../../logger.js"; -import { uploadFromUrl } from "@/services/drive/upload-from-url.js"; -import type { DriveFile } from "@/models/entities/drive-file.js"; -import type Bull from "bull"; - -const logger = queueLogger.createSubLogger("import-calckey-post"); - -export async function importCkPost( - job: Bull.Job, - done: any, -): Promise { - const user = await Users.findOneBy({ id: job.data.user.id }); - if (user == null) { - done(); - return; - } - const post = job.data.post; - if (post.replyId != null) { - done(); - return; - } - if (post.renoteId != null) { - done(); - return; - } - if (post.visibility !== "public") { - done(); - return; - } - const urls = (post.files || []) - .map((x: any) => x.url) - .filter((x: String) => x.startsWith("http")); - const files: DriveFile[] = []; - for (const url of urls) { - try { - const file = await uploadFromUrl({ - url: url, - user: user, - }); - files.push(file); - } catch (e) { - logger.error(`Skipped adding file to drive: ${url}`); - } - } - const { text, cw, localOnly, createdAt } = Post.parse(post); - const note = await create(user, { - createdAt: createdAt, - files: files.length == 0 ? undefined : files, - poll: undefined, - text: text || undefined, - reply: null, - renote: null, - cw: cw, - localOnly, - visibility: "hidden", - visibleUsers: [], - channel: null, - apMentions: new Array(0), - apHashtags: undefined, - apEmojis: undefined, - }); - logger.succ("Imported"); - done(); -}