Files
outline/app/stores/IntegrationsStore.ts
Tom Moor 9aad5a4bb7 feat: Add Gitea / Forgejo integration (#14336)
* 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
2026-10-25 18:04:04 -04:00

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;