From a9922f5c2f393c89c624a4e58b66757a2592a029 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 29 Oct 2022 08:44:27 +0200
Subject: [PATCH] =?UTF-8?q?fix(pr):=20don=E2=80=99t=20warn=20on=20edits=20?=
 =?UTF-8?q?(#18654)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../update/pr/body/controls.spec.ts           | 50 -------------------
 .../repository/update/pr/body/controls.ts     | 11 +---
 .../repository/update/pr/body/index.spec.ts   |  2 +-
 .../repository/update/pr/body/index.ts        |  2 +-
 4 files changed, 4 insertions(+), 61 deletions(-)
 delete mode 100644 lib/workers/repository/update/pr/body/controls.spec.ts

diff --git a/lib/workers/repository/update/pr/body/controls.spec.ts b/lib/workers/repository/update/pr/body/controls.spec.ts
deleted file mode 100644
index bfed66aef4..0000000000
--- a/lib/workers/repository/update/pr/body/controls.spec.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { mock } from 'jest-mock-extended';
-import { git } from '../../../../../../test/util';
-import type { BranchConfig } from '../../../../types';
-import { getControls } from './controls';
-
-jest.mock('../../../../../util/git');
-
-describe('workers/repository/update/pr/body/controls', () => {
-  describe('getControls', () => {
-    let branchConfig: BranchConfig;
-
-    beforeEach(() => {
-      jest.resetAllMocks();
-      branchConfig = mock<BranchConfig>();
-      branchConfig.branchName = 'branchName';
-    });
-
-    describe(`when the branch is modified`, () => {
-      beforeEach(() => {
-        git.isBranchModified.mockResolvedValue(true);
-      });
-
-      it('has the correct contents', async () => {
-        expect(await getControls(branchConfig)).toContain(
-          `- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. ⚠ **Warning**: custom changes will be lost.`
-        );
-        expect(git.isBranchModified).toHaveBeenCalledTimes(1);
-        expect(git.isBranchModified).toHaveBeenCalledWith(
-          branchConfig.branchName
-        );
-      });
-    });
-
-    describe(`when the branch is not modified`, () => {
-      beforeEach(() => {
-        git.isBranchModified.mockResolvedValue(false);
-      });
-
-      it('has the correct contents', async () => {
-        expect(await getControls(branchConfig)).toContain(
-          `- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.`
-        );
-        expect(git.isBranchModified).toHaveBeenCalledTimes(1);
-        expect(git.isBranchModified).toHaveBeenCalledWith(
-          branchConfig.branchName
-        );
-      });
-    });
-  });
-});
diff --git a/lib/workers/repository/update/pr/body/controls.ts b/lib/workers/repository/update/pr/body/controls.ts
index 037c672c04..c2e78b72d8 100644
--- a/lib/workers/repository/update/pr/body/controls.ts
+++ b/lib/workers/repository/update/pr/body/controls.ts
@@ -1,10 +1,3 @@
-import { emojify } from '../../../../../util/emoji';
-import { isBranchModified } from '../../../../../util/git';
-import type { BranchConfig } from '../../../../types';
-
-export async function getControls(config: BranchConfig): Promise<string> {
-  const warning = (await isBranchModified(config.branchName))
-    ? emojify(' :warning: **Warning**: custom changes will be lost.')
-    : '';
-  return `\n\n---\n\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.${warning}\n\n`;
+export function getControls(): string {
+  return `\n\n---\n\n - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box\n\n`;
 }
diff --git a/lib/workers/repository/update/pr/body/index.spec.ts b/lib/workers/repository/update/pr/body/index.spec.ts
index f9cb535ada..992b8f4c1e 100644
--- a/lib/workers/repository/update/pr/body/index.spec.ts
+++ b/lib/workers/repository/update/pr/body/index.spec.ts
@@ -42,7 +42,7 @@ describe('workers/repository/update/pr/body/index', () => {
       configDescription.getPrConfigDescription.mockResolvedValueOnce(
         'getPrConfigDescription'
       );
-      controls.getControls.mockResolvedValueOnce('getControls');
+      controls.getControls.mockReturnValueOnce('getControls');
       footer.getPrFooter.mockReturnValueOnce('getPrFooter');
       header.getPrHeader.mockReturnValueOnce('getPrHeader');
       notes.getPrExtraNotes.mockReturnValueOnce('getPrExtraNotes');
diff --git a/lib/workers/repository/update/pr/body/index.ts b/lib/workers/repository/update/pr/body/index.ts
index a0c21528aa..c3d25a8a8d 100644
--- a/lib/workers/repository/update/pr/body/index.ts
+++ b/lib/workers/repository/update/pr/body/index.ts
@@ -85,7 +85,7 @@ export async function getPrBody(
     notes: getPrNotes(branchConfig) + getPrExtraNotes(branchConfig),
     changelogs: getChangelogs(branchConfig),
     configDescription: await getPrConfigDescription(branchConfig),
-    controls: await getControls(branchConfig),
+    controls: getControls(),
     footer: getPrFooter(branchConfig),
   };
 
-- 
GitLab