feat(gitea): require a reason when the team refuses an application
CI / quality (push) Failing after 58s
CI / quality (push) Failing after 58s
A refusal without a reason leaves the member guessing why, which makes the recruitment feel arbitrary. The reject button now opens a modal, the reason is stored with the application, added to the review message and sent verbatim in the DM; when the DM cannot be delivered, the team gets it back to pass along.
This commit is contained in:
4 files changed
+122
-22
No files matched your search
@@ -18,6 +18,7 @@ import {
|
||||
ensureRecruitmentPanel,
|
||||
generatePassword,
|
||||
openApplicationModal,
|
||||
openRejectionModal,
|
||||
validateEmail,
|
||||
validateGiteaUsername,
|
||||
} from '../src/services/gitea/team-recruitment.js';
|
||||
@@ -69,6 +70,25 @@ describe('application answers', () => {
|
||||
['languages', 'level', 'experience', 'username', 'email'],
|
||||
);
|
||||
});
|
||||
|
||||
/** A refusal must carry a written reason, not a silent click. */
|
||||
it('asks the team for a reason when it refuses an application', async () => {
|
||||
let shown;
|
||||
await openRejectionModal(
|
||||
{
|
||||
showModal: async (modal) => {
|
||||
shown = modal.toJSON();
|
||||
},
|
||||
},
|
||||
{ id: 7 },
|
||||
);
|
||||
|
||||
assert.equal(shown.custom_id, 'gitea-team:reject:7');
|
||||
assert.equal(shown.components.length, 1);
|
||||
assert.equal(shown.components[0].components[0].custom_id, 'reason');
|
||||
assert.equal(shown.components[0].components[0].style, 2, 'the reason is a paragraph');
|
||||
assert.equal(shown.components[0].components[0].required, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('recruitment repository', () => {
|
||||
@@ -134,6 +154,14 @@ describe('recruitment repository', () => {
|
||||
assert.equal(rejectApplication(id, 'staff'), 0);
|
||||
});
|
||||
|
||||
it('keeps the reason of the refusal for the member', () => {
|
||||
const id = apply();
|
||||
|
||||
rejectApplication(id, 'staff', 'Il manque une présentation sur le salon.');
|
||||
|
||||
assert.equal(getApplication(id).rejection_reason, 'Il manque une présentation sur le salon.');
|
||||
});
|
||||
|
||||
it('keeps one panel row per guild and updates it', () => {
|
||||
assert.equal(getRecruitmentPanel(GUILD_ID), null);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user