mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
chore: Decouple core plugins (#14340)
* chore: Move plugin-specific integration code into plugins Core no longer imports from or names the settings of individual plugins. Plugins now register mention providers, issue status icons, instance URLs, settings keys, settings and import schemas, and OAuth clients through hooks. * fix: Recompute embed instance URLs after plugins load and match legacy issue icons by URL * fix: Skip logo upload jobs queued without a settings path * chore: Choose issue status icons from the unfurl state
This commit is contained in:
1 parent
5901b1213c
commit
6d7cd455e9
80 files changed
+1222
-856
No files matched your search
@@ -1,6 +1,13 @@
|
||||
import { IntegrationService } from "@shared/types";
|
||||
import { IntegrationService, IntegrationType } from "@shared/types";
|
||||
import { Integration } from "@server/models";
|
||||
import { buildAdmin, buildUser, buildViewer } from "@server/test/factories";
|
||||
import {
|
||||
buildAdmin,
|
||||
buildGuestUser,
|
||||
buildIntegration,
|
||||
buildTeam,
|
||||
buildUser,
|
||||
buildViewer,
|
||||
} from "@server/test/factories";
|
||||
import { getTestServer } from "@server/test/support";
|
||||
import { GitHub, InstallationAccess } from "../github";
|
||||
import { SetupAction } from "./schema";
|
||||
@@ -136,3 +143,60 @@ describe("#github.callback", () => {
|
||||
expect(res.status).toEqual(403);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#integrations.list", () => {
|
||||
it("should expose the github settings of the integration", async () => {
|
||||
const team = await buildTeam();
|
||||
const member = await buildUser({ teamId: team.id });
|
||||
const installation = {
|
||||
id: 1,
|
||||
account: { id: 2, name: "outline", avatarUrl: "https://example.com" },
|
||||
};
|
||||
await buildIntegration({
|
||||
userId: member.id,
|
||||
teamId: team.id,
|
||||
service: IntegrationService.GitHub,
|
||||
type: IntegrationType.Embed,
|
||||
settings: {
|
||||
github: { installation },
|
||||
url: "https://example.com",
|
||||
},
|
||||
});
|
||||
|
||||
const res = await server.post("/api/integrations.list", member);
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data[0].settings).toEqual({
|
||||
url: "https://example.com",
|
||||
github: { installation },
|
||||
});
|
||||
});
|
||||
|
||||
it("should not expose github settings to guests", async () => {
|
||||
const team = await buildTeam();
|
||||
const admin = await buildAdmin({ teamId: team.id });
|
||||
const guest = await buildGuestUser({ teamId: team.id });
|
||||
await buildIntegration({
|
||||
userId: admin.id,
|
||||
teamId: team.id,
|
||||
service: IntegrationService.GitHub,
|
||||
type: IntegrationType.Embed,
|
||||
settings: {
|
||||
url: "https://example.com",
|
||||
github: {
|
||||
installation: {
|
||||
id: 123,
|
||||
account: { id: 456, name: "acme", avatarUrl: "" },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const res = await server.post("/api/integrations.list", guest);
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data[0].settings).toEqual({ url: "https://example.com" });
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user