From 19b9b3b621cd844b1ef781717e4b41a6071957a2 Mon Sep 17 00:00:00 2001 From: Anna Zhang Date: Mon, 22 Jan 2024 14:39:05 -0500 Subject: [PATCH] Resolve request-promise-native errors --- src/posts/bookmarks.js | 5 +++-- src/posts/bookmarks.ts | 4 ++-- src/posts/index.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/posts/bookmarks.js b/src/posts/bookmarks.js index 1b6ab5a5c9..93ddfd781d 100644 --- a/src/posts/bookmarks.js +++ b/src/posts/bookmarks.js @@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", { value: true }); const db = require("../database"); const plugins = require("../plugins"); -module.exports = function (Posts) { +function default_1(Posts) { function toggleBookmark(type, pid, uid) { return __awaiter(this, void 0, void 0, function* () { if (parseInt(uid, 10) <= 0) { @@ -77,4 +77,5 @@ module.exports = function (Posts) { return yield db.isSetMember(`pid:${pid}:users_bookmarked`, uid); }); }; -}; +} +exports.default = default_1; diff --git a/src/posts/bookmarks.ts b/src/posts/bookmarks.ts index cec897707d..5abfaf82c4 100644 --- a/src/posts/bookmarks.ts +++ b/src/posts/bookmarks.ts @@ -14,7 +14,7 @@ type Post = { setPostField: (pid: string, field: string, bookmarks: string[]) => Promise; } -module.exports = function (Posts: Post) { +export default function (Posts: Post) { async function toggleBookmark(type: string, pid: string, uid: string) { if (parseInt(uid, 10) <= 0) { throw new Error('[[error:not-logged-in]]'); @@ -82,4 +82,4 @@ module.exports = function (Posts: Post) { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call return await db.isSetMember(`pid:${pid}:users_bookmarked`, uid) as boolean; }; -}; +} diff --git a/src/posts/index.js b/src/posts/index.js index baf25d20a0..5e03d21823 100644 --- a/src/posts/index.js +++ b/src/posts/index.js @@ -22,7 +22,7 @@ require('./summary')(Posts); require('./recent')(Posts); require('./tools')(Posts); require('./votes')(Posts); -require('./bookmarks')(Posts); +require('./bookmarks').default(Posts); require('./queue')(Posts); require('./diffs')(Posts); require('./uploads')(Posts);