Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
Fix commit listing, adding new commits to list instead of replacing
Merged did:key:z6MkkfM3...sVz5 opened 1 year ago
7 files changed +37 -9 cbb6c557 7a5d4566
modified config/custom-environment-variables.json
@@ -11,6 +11,9 @@
      "__format": "json"
    }
  },
+
  "source": {
+
    "commitsPerPage": "COMMITS_PER_PAGE"
+
  },
  "supportWebsite": "SUPPORT_WEBSITE",
  "fallbackPreferredSeed": {
    "__name": "FALLBACK_PREFERRED_SEED",
modified config/default.json
@@ -16,6 +16,9 @@
      }
    ]
  },
+
  "source": {
+
    "commitsPerPage": 30
+
  },
  "supportWebsite": "https://radicle.zulipchat.com",
  "fallbackPreferredSeed": {
    "hostname": "seed.radicle.garden",
modified module.d.ts
@@ -10,6 +10,9 @@ declare module "virtual:*" {
      defaultHttpdScheme: string;
      pinned: { baseUrl: BaseUrl }[];
    };
+
    source: {
+
      commitsPerPage: number;
+
    };
    reactions: string[];
    supportWebsite: string;
    fallbackPreferredSeed: BaseUrl;
modified playwright.config.ts
@@ -82,10 +82,19 @@ const config: PlaywrightTestConfig = {
    },
  ],

-
  webServer: {
-
    command: "npm run start -- --strictPort --port 3001",
-
    port: 3001,
-
  },
+
  webServer: [
+
    {
+
      command: "npm run start -- --strictPort --port 3001",
+
      port: 3001,
+
    },
+
    // Required by test tests/e2e/project/commits.spec.ts "loading more commits, adds them to the commits list"
+
    {
+
      command: "npm run start -- --strictPort --port 3002",
+
      port: 3002,
+
      // eslint-disable-next-line @typescript-eslint/naming-convention
+
      env: { COMMITS_PER_PAGE: "4" },
+
    },
+
  ],
};

export default config;
modified src/views/projects/History.svelte
@@ -9,7 +9,7 @@
  } from "@http-client";
  import type { ProjectRoute } from "./router";

-
  import { COMMITS_PER_PAGE } from "./router";
+
  import config from "virtual:config";
  import { HttpdClient } from "@http-client";
  import { baseUrlToString } from "@app/lib/utils";
  import { groupCommits } from "@app/lib/commit";
@@ -58,9 +58,9 @@
      const response = await api.project.getAllCommits(project.id, {
        parent: allCommitHeaders[0].id,
        page,
-
        perPage: COMMITS_PER_PAGE,
+
        perPage: config.source.commitsPerPage,
      });
-
      allCommitHeaders = response;
+
      allCommitHeaders = [...allCommitHeaders, ...response];
    } catch (e) {
      error = e;
    }
modified src/views/projects/router.ts
@@ -29,7 +29,6 @@ import { handleError, unreachableError } from "@app/views/projects/error";
import { HttpdClient } from "@http-client";
import { ResponseError, ResponseParseError } from "@http-client/lib/fetcher";

-
export const COMMITS_PER_PAGE = 30;
export const PATCHES_PER_PAGE = 10;
export const ISSUES_PER_PAGE = 10;

@@ -524,7 +523,7 @@ async function loadHistoryView(
    await api.project.getAllCommits(project.id, {
      parent: commitId,
      page: 0,
-
      perPage: COMMITS_PER_PAGE,
+
      perPage: config.source.commitsPerPage,
    }),
  ]);

modified tests/e2e/project/commits.spec.ts
@@ -87,6 +87,17 @@ test("peer and branch switching", async ({ page }) => {
  }
});

+
test("loading more commits, adds them to the commits list", async ({
+
  page,
+
}) => {
+
  await page.goto(`http://localhost:3002${sourceBrowsingUrl}`);
+
  await page.getByRole("button", { name: "Commits" }).click();
+
  await expect(page.locator("div > div > .teaser")).toHaveCount(4);
+

+
  await page.getByRole("button", { name: "More" }).click();
+
  await expect(page.locator("div > div > .teaser")).toHaveCount(8);
+
});
+

test("commit messages with double colon not converted into single colon", async ({
  page,
}) => {