History

fix(server): retain GitLab approval system notes

Julius Marminge committed 2 months ago

Commit 33037eb1 parent ce4712d3 files · +146 −11Browse files

Showing the changes to apps/server/src/pullRequest/gitLabMergeRequestJson.test.ts (1 of 3 files). Show all

Unified · Split

apps/server/src/pullRequest/gitLabMergeRequestJson.test.ts+65−0
@@ -247,6 +247,71 @@ describe("decodeViewerJson", () => { · 246 unmodified lines
247247 });
248248
249249 describe("decodeNotesJson", () => {
250+ it("retains approval and withdrawal notes without classifying authored comments as verdicts", () => {
251+ const notes = expectSuccess(
252+ decodeNotesJson(
253+ JSON.stringify([
254+ {
255+ id: 1,
256+ body: "approved this merge request",
257+ author: { username: "reviewer" },
258+ system: true,
259+ created_at: "2026-07-01T00:00:00Z",
260+ },
261+ {
262+ id: 2,
263+ body: "unapproved this merge request",
264+ author: { username: "reviewer" },
265+ system: true,
266+ created_at: "2026-07-02T00:00:00Z",
267+ },
268+ {
269+ id: 3,
270+ body: "approved this merge request",
271+ author: { username: "author" },
272+ system: false,
273+ created_at: "2026-07-03T00:00:00Z",
274+ },
275+ {
276+ id: 4,
277+ body: "assigned to @reviewer",
278+ system: true,
279+ created_at: "2026-07-04T00:00:00Z",
280+ },
281+ {
282+ id: 5,
283+ body: "approved this merge request with a custom message",
284+ system: true,
285+ created_at: "2026-07-05T00:00:00Z",
286+ },
287+ ]),
288+ ),
289+ );
290+
291+ expect(notes.rawCount).toBe(5);
292+ expect(notes.comments).toMatchObject([
293+ {
294+ id: "1",
295+ kind: "review",
296+ body: "approved this merge request",
297+ author: { login: "reviewer" },
298+ createdAt: "2026-07-01T00:00:00Z",
299+ reviewState: "APPROVED",
300+ path: null,
301+ },
302+ {
303+ id: "2",
304+ kind: "review",
305+ body: "unapproved this merge request",
306+ author: { login: "reviewer" },
307+ createdAt: "2026-07-02T00:00:00Z",
308+ reviewState: "DISMISSED",
309+ path: null,
310+ },
311+ { id: "3", kind: "issue-comment", reviewState: null },
312+ ]);
313+ });
314+
250315 it("keeps comments and drops GitLab's own activity notes", () => {
251316 const notes = expectSuccess(
252317 decodeNotesJson(