Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain github manual edit warning #1293

Merged
merged 6 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/app/core/models/issue.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { TesterResponseTemplate } from './templates/tester-response-template.mod
import { TutorModerationIssueTemplate } from './templates/tutor-moderation-issue-template.model';
import { TutorModerationTodoTemplate } from './templates/tutor-moderation-todo-template.model';
import { TesterResponse } from './tester-response.model';
import { GITHUB_UI_EDIT_WARNING } from './templates/tester-response-template.model';

export class Issue {
/** Basic Fields */
Expand Down Expand Up @@ -286,6 +287,8 @@ export class Issue {
// Template url: https://github.com/CATcher-org/templates#teams-response-1
createGithubTesterResponse(): string {
return (
GITHUB_UI_EDIT_WARNING +
'\n' +
`# Team\'s Response\n${this.teamResponse}\n` +
`# Items for the Tester to Verify\n${this.getTesterResponsesString(this.testerResponses)}`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interface TesterResponseParseResult {
teamChosenType: string;
}

const GITHUB_UI_EDIT_WARNING =
export const GITHUB_UI_EDIT_WARNING =
// eslint-disable-next-line max-len
'[IMPORTANT!: Please do not edit or reply to this comment using the GitHub UI. You can respond to it using CATcher during the next phase of the PE]';
const TESTER_RESPONSES_HEADER = '# Items for the Tester to Verify';
Expand All @@ -72,7 +72,7 @@ const DISAGREE_CHECKBOX_DESCRIPTION = 'I disagree';
const TeamResponseSectionParser = buildTeamResponseSectionParser(TESTER_RESPONSES_HEADER);

export const TesterResponseParser = coroutine(function* () {
yield possibly(str(GITHUB_UI_EDIT_WARNING));
yield str(GITHUB_UI_EDIT_WARNING);
yield optionalWhitespace;

const teamResponse = yield TeamResponseSectionParser;
Expand Down
10 changes: 8 additions & 2 deletions tests/model/issue.model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,20 @@ describe('Issue', () => {
phaseTesterResponseIssue.teamResponse = 'Sample Text';
phaseTesterResponseIssue.testerResponses = [];
expect(phaseTesterResponseIssue.createGithubTesterResponse()).toEqual(
`# Team\'s Response\n${phaseTesterResponseIssue.teamResponse}\n` + `# Items for the Tester to Verify\n${''}`
`[IMPORTANT!: Please do not edit or reply to this comment using the GitHub UI. ` +
`You can respond to it using CATcher during the next phase of the PE]\n` +
`# Team\'s Response\n${phaseTesterResponseIssue.teamResponse}\n` +
`# Items for the Tester to Verify\n${''}`
);

const phaseTesterResponseIssue2 = dummyIssueWithTeam.clone(Phase.phaseTesterResponse);
phaseTesterResponseIssue2.teamResponse = 'Sample Text';
phaseTesterResponseIssue2.testerResponses = [newTesterResponse];
expect(phaseTesterResponseIssue2.createGithubTesterResponse()).toEqual(
`# Team\'s Response\n${phaseTesterResponseIssue.teamResponse}\n` + `# Items for the Tester to Verify\n${newTesterResponse.toString()}`
`[IMPORTANT!: Please do not edit or reply to this comment using the GitHub UI. ` +
`You can respond to it using CATcher during the next phase of the PE]\n` +
`# Team\'s Response\n${phaseTesterResponseIssue.teamResponse}\n` +
`# Items for the Tester to Verify\n${newTesterResponse.toString()}`
);
});

Expand Down
Loading