diff --git a/app/editor/components/CreateIssueDialog.tsx b/app/editor/components/CreateIssueDialog.tsx index 25d2487811..4c92239463 100644 --- a/app/editor/components/CreateIssueDialog.tsx +++ b/app/editor/components/CreateIssueDialog.tsx @@ -90,7 +90,7 @@ export const CreateIssueDialog = observer( , @@ -131,7 +131,7 @@ const SourceItem = ({ - {source.account.name} + {source.owner.name} diff --git a/app/editor/menus/formatting.tsx b/app/editor/menus/formatting.tsx index 3581063de3..1fa50d93c1 100644 --- a/app/editor/menus/formatting.tsx +++ b/app/editor/menus/formatting.tsx @@ -62,7 +62,7 @@ export default function formattingMenuItems( const issueSourcesChildren = recentIssueSources.length ? recentIssueSources.map((source) => ({ name: "issue", - label: `${source.account.name}/${source.name}`, + label: `${source.owner.name}/${source.name}`, icon: , attrs: { title: selectedText, diff --git a/plugins/github/server/GitHubIssueProvider.ts b/plugins/github/server/GitHubIssueProvider.ts index a7affda850..ff5e675b7a 100644 --- a/plugins/github/server/GitHubIssueProvider.ts +++ b/plugins/github/server/GitHubIssueProvider.ts @@ -33,7 +33,7 @@ export class GitHubIssueProvider extends BaseIssueProvider { const sources = repos.map((repo) => ({ id: String(repo.id), name: repo.name, - account: { id: String(repo.owner.id), name: repo.owner.login }, + owner: { id: String(repo.owner.id), name: repo.owner.login }, service: IntegrationService.GitHub, })); @@ -49,7 +49,7 @@ export class GitHubIssueProvider extends BaseIssueProvider { where: { service: IntegrationService.GitHub, teamId: actor.teamId, - "settings.github.installation.account.name": source.account.name, + "settings.github.installation.account.name": source.owner.name, }, })) as Integration | undefined; @@ -63,7 +63,7 @@ export class GitHubIssueProvider extends BaseIssueProvider { ); const { data } = await client.createIssue({ - owner: source.account.name, + owner: source.owner.name, repo: source.name, title, }); diff --git a/plugins/github/server/github.ts b/plugins/github/server/github.ts index f5bb4a3f76..88f9ba1409 100644 --- a/plugins/github/server/github.ts +++ b/plugins/github/server/github.ts @@ -108,11 +108,9 @@ const CustomOctokit = Octokit.plugin(requestPlugin); export class GitHub { private static appId = env.GITHUB_APP_ID; - // private static appKey = env.GITHUB_APP_PRIVATE_KEY - // ? Buffer.from(env.GITHUB_APP_PRIVATE_KEY, "base64").toString("ascii") - // : undefined; - - private static appKey = env.GITHUB_APP_PRIVATE_KEY; + private static appKey = env.GITHUB_APP_PRIVATE_KEY + ? Buffer.from(env.GITHUB_APP_PRIVATE_KEY, "base64").toString("ascii") + : undefined; private static clientId = env.GITHUB_CLIENT_ID; private static clientSecret = env.GITHUB_CLIENT_SECRET; diff --git a/server/queues/processors/IntegrationCreatedProcessor.ts b/server/queues/processors/IntegrationCreatedProcessor.ts index 2cdef25efd..8dc45bd8a4 100644 --- a/server/queues/processors/IntegrationCreatedProcessor.ts +++ b/server/queues/processors/IntegrationCreatedProcessor.ts @@ -22,7 +22,6 @@ export default class IntegrationCreatedProcessor extends BaseProcessor { // Store the available issue sources in the integration record. await CacheIssueSourcesTask.schedule({ integrationId: integration.id, - actorId: event.actorId, }); // Clear the cache of unfurled data for the team as it may be stale now. diff --git a/server/queues/tasks/CacheIssueSourcesTask.ts b/server/queues/tasks/CacheIssueSourcesTask.ts index dec7cb9286..5bf84fddc9 100644 --- a/server/queues/tasks/CacheIssueSourcesTask.ts +++ b/server/queues/tasks/CacheIssueSourcesTask.ts @@ -1,4 +1,4 @@ -import { Integration, User } from "@server/models"; +import { Integration } from "@server/models"; import { sequelize } from "@server/storage/database"; import { Hook, PluginManager } from "@server/utils/PluginManager"; import BaseTask from "./BaseTask"; @@ -7,20 +7,16 @@ const plugins = PluginManager.getHooks(Hook.IssueProvider); type Props = { integrationId: string; - actorId: string; }; export default class CacheIssueSourcesTask extends BaseTask { - async perform({ integrationId, actorId }: Props) { + async perform({ integrationId }: Props) { await sequelize.transaction(async (transaction) => { - const [integration, actor] = await Promise.all([ - Integration.findByPk(integrationId, { - transaction, - lock: transaction.LOCK.UPDATE, - }), - User.findByPk(actorId), - ]); - if (!integration || !actor) { + const integration = await Integration.findByPk(integrationId, { + transaction, + lock: transaction.LOCK.UPDATE, + }); + if (!integration) { return; } diff --git a/shared/schema.ts b/shared/schema.ts index 6d33291f58..1527677af3 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -62,7 +62,7 @@ export type ImportTaskOutput = { export const IssueSource = z.object({ id: z.string().nonempty(), name: z.string().nonempty(), - account: z.object({ + owner: z.object({ id: z.string().nonempty(), name: z.string().nonempty(), }),