Skip to content

Commit

Permalink
Retain github manual edit warning (#1293)
Browse files Browse the repository at this point in the history
Retain github manual edit warning when editing/submitting in tester response phase

Github manual edit warning message disappears after editing/submitting in 
tester response phase.

The warning message should remain in the issue comment to warn testers 
against editing directly their response on GitHub directly.
  • Loading branch information
wx-03 authored Feb 1, 2025
1 parent 8fc0feb commit afc06cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
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

0 comments on commit afc06cb

Please sign in to comment.