mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* feat: Add Gitea integration for issue, pull request, and repository previews * fix: Gitea repository previews and request deadlines Refresh the token before repository discovery, keep repository previews when the issue tracker is disabled, and keep the request timeout active while the response body is read. * chore: Use the shared fetch timeout for Gitea requests * chore: Mention Forgejo in Gitea copy and reuse the callback URL helper * Remove service specific getters in IntegrationsStore
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { override } from "mobx";
|
|
import { computedFn } from "mobx-utils";
|
|
import type { IntegrationService, IntegrationType } from "@shared/types";
|
|
import naturalSort from "@shared/utils/naturalSort";
|
|
import type RootStore from "~/stores/RootStore";
|
|
import Store from "~/stores/base/Store";
|
|
import Integration from "~/models/Integration";
|
|
|
|
class IntegrationsStore extends Store<Integration> {
|
|
constructor(rootStore: RootStore) {
|
|
super(rootStore, Integration);
|
|
}
|
|
|
|
findByService(service: string) {
|
|
return this.orderedData.find(
|
|
(integration) => integration.service === service
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns the integrations for a service, ordered by name.
|
|
*
|
|
* @param service the service to return integrations for.
|
|
* @returns the integrations for the service.
|
|
*/
|
|
filterByService = computedFn(
|
|
(service: IntegrationService): Integration<IntegrationType.Embed>[] =>
|
|
this.orderedData.filter((integration) => integration.service === service),
|
|
{ requiresReaction: false }
|
|
);
|
|
|
|
@override
|
|
get orderedData(): Integration[] {
|
|
return naturalSort(Array.from(this.data.values()), "name");
|
|
}
|
|
}
|
|
|
|
export default IntegrationsStore;
|