feat: add candidate privacy controls

This commit is contained in:
TakuyaYagam1 committed 2026-10-08 08:43:11 +03:00
1 parent e6bd66c560
commit 95b8e566c4
20 files changed
+2592 -11

No files matched your search

+30 -9
View File
@@ -3,6 +3,7 @@ import { renderToString } from "react-dom/server";
import { StaticRouterProvider, createStaticHandler, createStaticRouter } from "react-router-dom";
import { describe, expect, it } from "vitest";
import { assessmentQueryKeys } from "../../entities/assessment";
import { candidateViewQueryKeys } from "../../entities/candidate-view";
import { getListMyConsentsQueryKey } from "../../shared/api/endpoints/consent/consent";
import { getGetCurrentSessionQueryKey } from "../../shared/api/endpoints/identity/identity";
import type { Session } from "../../shared/api/schemas";
@@ -55,6 +56,26 @@ async function render(path: string): Promise<string | Response> {
}
if (path.startsWith("/candidate/privacy")) {
const hasMore = path.includes("history=partial");
const actorId = "11111111-1111-4111-8111-111111111111";
queryClient.setQueryData(candidateViewQueryKeys.settings(actorId), {
publication: {
state: "closed",
closed_reason: "never_published",
fields: [],
consent_id: null,
published_at: null,
version: 0,
},
search_status: {
value: "not_looking",
lapsed: false,
confirmed_at: null,
lapses_at: null,
version: 0,
},
hidden_organizations_total: 0,
});
queryClient.setQueryData(["candidate-view", actorId, "consent-history-ready"], true);
queryClient.setQueryData(getListMyConsentsQueryKey({ limit: 100 }), {
pages: [
{
@@ -133,7 +154,7 @@ describe("route groups", () => {
["/candidate/profile", "Профиль", "Разделы кабинета кандидата"],
["/candidate/questionnaire", "Анкета", "Разделы кабинета кандидата"],
["/candidate/onboarding", "Первые шаги", "Разделы кабинета кандидата"],
["/candidate/privacy", "Согласия и настройки приватности", "Разделы кабинета кандидата"],
["/candidate/privacy", "Настройки приватности", "Разделы кабинета кандидата"],
["/candidate/assessment", "Проверка знаний", "Разделы кабинета кандидата"],
[
"/candidate/assessment/01928f7a-9c0d-7e1f-8a2b-3c4d5e6f7a80",
@@ -235,20 +256,20 @@ describe("product readiness", () => {
expect(html).toContain("Это не показатель готовности продукта");
});
it("renders the consent settings route with server-backed history", async () => {
it("renders separate privacy controls while preparing actor-scoped consent history", async () => {
const html = await renderHtml("/candidate/privacy");
expect(html).toContain("Публикация карточки кандидата");
expect(html).toContain("c2-2026-10-01");
expect(html).toContain("Первая тестовая компания");
expect(html).toContain("Электронная почта");
expect(html).toContain("Публикация карточки");
expect(html).toContain("Статус поиска");
expect(html).toContain("Подготавливаем историю согласий...");
expect(html).not.toContain("c2-2026-10-01");
expect(html).not.toContain("Первая тестовая компания");
});
it("does not call a purpose empty while older history pages remain", async () => {
it("does not call consent history empty before actor-scoped loading", async () => {
const html = await renderHtml("/candidate/privacy?history=partial");
expect(html).toContain("В загруженной части истории записей C3 пока нет");
expect(html).toContain("Показать более ранние записи");
expect(html).toContain("Подготавливаем историю согласий...");
expect(html).not.toContain("Записей C3 пока нет.");
});
+2 -2
View File
@@ -3,7 +3,7 @@ import { AssessmentAttemptPage, AssessmentPage } from "../../pages/assessment";
import { LoginPage, RegisterPage, VerifyEmailPage } from "../../pages/auth";
import { CandidateOnboardingPage } from "../../pages/candidate-onboarding";
import { CompanyPage } from "../../pages/company";
import { ConsentsPage } from "../../pages/consents";
import { PrivacyPage } from "../../pages/privacy";
import { SessionGate } from "../../entities/session";
import { NotFoundPage } from "../../pages/not-found";
import { NeedEditorPage } from "../../pages/need-editor";
@@ -84,7 +84,7 @@ export const routes: RouteObject[] = [
},
{
path: paths.candidate.privacy,
element: <ConsentsPage />,
element: <PrivacyPage />,
},
{ path: paths.candidate.supportCases, element: <SupportCasesPage /> },
{ path: paths.candidate.supportNew, element: <CreateSupportCasePage /> },