mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
fix: allows user to save an alias and checklistCollapsed properties of a challenge task. fixes #7875 (#8170)
This commit is contained in:
@@ -74,6 +74,7 @@ describe('PUT /tasks/:id', () => {
|
|||||||
checklist: [
|
checklist: [
|
||||||
{text: 123, completed: false},
|
{text: 123, completed: false},
|
||||||
],
|
],
|
||||||
|
collapseChecklist: false,
|
||||||
});
|
});
|
||||||
await sleep(2);
|
await sleep(2);
|
||||||
|
|
||||||
@@ -111,6 +112,7 @@ describe('PUT /tasks/:id', () => {
|
|||||||
{text: 123, completed: false},
|
{text: 123, completed: false},
|
||||||
{text: 456, completed: true},
|
{text: 456, completed: true},
|
||||||
],
|
],
|
||||||
|
collapseChecklist: true,
|
||||||
notes: 'new notes',
|
notes: 'new notes',
|
||||||
attribute: 'per',
|
attribute: 'per',
|
||||||
tags: [challengeUserTaskId],
|
tags: [challengeUserTaskId],
|
||||||
@@ -143,6 +145,8 @@ describe('PUT /tasks/:id', () => {
|
|||||||
expect(savedChallengeUserTask.streak).to.equal(25);
|
expect(savedChallengeUserTask.streak).to.equal(25);
|
||||||
expect(savedChallengeUserTask.reminders.length).to.equal(2);
|
expect(savedChallengeUserTask.reminders.length).to.equal(2);
|
||||||
expect(savedChallengeUserTask.checklist.length).to.equal(2);
|
expect(savedChallengeUserTask.checklist.length).to.equal(2);
|
||||||
|
expect(savedChallengeUserTask.alias).to.equal('a-short-task-name');
|
||||||
|
expect(savedChallengeUserTask.collapseChecklist).to.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ TaskSchema.statics.findByIdOrAlias = async function findByIdOrAlias (identifier,
|
|||||||
TaskSchema.statics.sanitizeUserChallengeTask = function sanitizeUserChallengeTask (taskObj) {
|
TaskSchema.statics.sanitizeUserChallengeTask = function sanitizeUserChallengeTask (taskObj) {
|
||||||
let initialSanitization = this.sanitize(taskObj);
|
let initialSanitization = this.sanitize(taskObj);
|
||||||
|
|
||||||
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes']);
|
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes', 'collapseChecklist', 'alias']);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sanitize checklist objects (disallowing id)
|
// Sanitize checklist objects (disallowing id)
|
||||||
|
|||||||
Reference in New Issue
Block a user