// glossary-ignore-file: где лежит код и кто его видит, показано только в виде «Инженер» // Where a project's Gitea repo is and who can see it (PEP-15). Read live from Gitea: // visibility and collaborators can be changed there, so Peppa does not store them. import { m as tr } from "@peppa/shared/i18n"; export interface RepoInfo { /** owner/repo */ fullName: string; url: string; /** Null when Gitea could not be asked. */ private: boolean | null; ownerKind: "user" | "org" | null; collaborators: string[] | null; } /** Who can see the repo, in one Russian sentence fragment. */ export function repoAudience(r: Pick): string { if (r.private === null) return tr("не удалось узнать у Gitea"); if (!r.private) return tr("все, у кого есть доступ к Gitea"); const owner = r.fullName.split("/")[0]!; const list = r.collaborators?.length ? r.collaborators.join(", ") : null; if (r.ownerKind === "org") { return list ? tr("участники организации {owner} с доступом к репозиторию и соавторы: {list}", { owner, list }) : tr("участники организации {owner} с доступом к репозиторию", { owner }); } return list ? tr("{owner} и соавторы: {list}", { owner, list }) : owner; } export function repoVisibilityLabel(isPrivate: boolean | null): string { return isPrivate === null ? tr("видимость неизвестна") : isPrivate ? tr("приватный") : tr("публичный"); }