Skip to content

Commit

Permalink
fix test - remove changes on text/up/down - revert sanitize condition…
Browse files Browse the repository at this point in the history
… - revert sanitization props
  • Loading branch information
negue committed Sep 27, 2018
1 parent e12ef02 commit 557fc35
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
Expand Up @@ -38,16 +38,10 @@ describe('PUT /tasks/:id', () => {

it('updates a group task', async () => {
let savedHabit = await user.put(`/tasks/${task._id}`, {
text: 'some new text',
up: false,
down: false,
notes: 'some new notes',
});

expect(savedHabit.text).to.eql('some new text');
expect(savedHabit.notes).to.eql('some new notes');
expect(savedHabit.up).to.eql(false);
expect(savedHabit.down).to.eql(false);
});

it('updates a group task - approval is required', async () => {
Expand Down
2 changes: 1 addition & 1 deletion website/server/controllers/api-v3/tasks.js
Expand Up @@ -466,7 +466,7 @@ api.updateTask = {

if (!challenge && task.userId && task.challenge && task.challenge.id) {
sanitizedObj = Tasks.Task.sanitizeUserChallengeTask(updatedTaskObj);
} else if (!challenge && task.isChallengeTask || task.group && task.group.id) {
} else if (!group && task.userId && task.group && task.group.id) {
sanitizedObj = Tasks.Task.sanitizeUserChallengeTask(updatedTaskObj);
} else {
sanitizedObj = Tasks.Task.sanitize(updatedTaskObj);
Expand Down
3 changes: 1 addition & 2 deletions website/server/models/task.js
Expand Up @@ -173,9 +173,8 @@ TaskSchema.statics.sanitizeUserChallengeTask = function sanitizeUserChallengeTas

return _.pick(initialSanitization, [
'streak', 'checklist', 'attribute', 'reminders',
'tags', 'notes', 'text', 'collapseChecklist',
'tags', 'notes', 'collapseChecklist',
'alias', 'yesterDaily', 'counterDown', 'counterUp',
'up', 'down',
]);
};

Expand Down

0 comments on commit 557fc35

Please sign in to comment.