mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
More staging fixes (#9816)
* Added ability to adjust challenge task copy's streak * Disabled stat allocation if method is incorrect
This commit is contained in:
committed by
Matteo Pagliazzi
parent
6d57ce3050
commit
c0276e3663
@@ -139,6 +139,23 @@ describe('PUT /tasks/:id', () => {
|
|||||||
expect(savedHabit.up).to.eql(false);
|
expect(savedHabit.up).to.eql(false);
|
||||||
expect(savedHabit.down).to.eql(false);
|
expect(savedHabit.down).to.eql(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('allows user to update their copy', async () => {
|
||||||
|
const userTasks = await user.get('/tasks/user');
|
||||||
|
const userChallengeTasks = userTasks.filter(task => task.challenge.id === challenge._id);
|
||||||
|
const userCopyOfChallengeTask = userChallengeTasks[0];
|
||||||
|
|
||||||
|
await user.put(`/tasks/${userCopyOfChallengeTask._id}`, {
|
||||||
|
notes: 'some new notes',
|
||||||
|
counterDown: 1,
|
||||||
|
counterUp: 2,
|
||||||
|
});
|
||||||
|
const savedHabit = await user.get(`/tasks/${userCopyOfChallengeTask._id}`);
|
||||||
|
|
||||||
|
expect(savedHabit.notes).to.eql('some new notes');
|
||||||
|
expect(savedHabit.counterDown).to.eql(1);
|
||||||
|
expect(savedHabit.counterUp).to.eql(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
context('todos', () => {
|
context('todos', () => {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@
|
|||||||
.svg-icon.info-icon(v-html="icons.information", v-b-tooltip.hover.righttop.html="$t('attributeAllocationHelp')")
|
.svg-icon.info-icon(v-html="icons.information", v-b-tooltip.hover.righttop.html="$t('attributeAllocationHelp')")
|
||||||
.attributes
|
.attributes
|
||||||
.custom-control.custom-radio.custom-control-inline(v-for="attr in ATTRIBUTES", :key="attr")
|
.custom-control.custom-radio.custom-control-inline(v-for="attr in ATTRIBUTES", :key="attr")
|
||||||
input.custom-control-input(:id="`attribute-${attr}`", type="radio", :value="attr", v-model="task.attribute")
|
input.custom-control-input(:id="`attribute-${attr}`", type="radio", :value="attr", v-model="task.attribute", :disabled="user.preferences.allocationMode !== 'taskbased'")
|
||||||
label.custom-control-label.attr-description(:for="`attribute-${attr}`", v-once, v-b-popover.hover="$t(`${attr}Text`)") {{ $t(attributesStrings[attr]) }}
|
label.custom-control-label.attr-description(:for="`attribute-${attr}`", v-once, v-b-popover.hover="$t(`${attr}Text`)") {{ $t(attributesStrings[attr]) }}
|
||||||
.delete-task-btn.d-flex.justify-content-center.align-items-middle(@click="destroy()", v-if="purpose !== 'create' && !challengeAccessRequired")
|
.delete-task-btn.d-flex.justify-content-center.align-items-middle(@click="destroy()", v-if="purpose !== 'create' && !challengeAccessRequired")
|
||||||
.svg-icon.d-inline-b(v-html="icons.destroy")
|
.svg-icon.d-inline-b(v-html="icons.destroy")
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
"hard": "Hard",
|
"hard": "Hard",
|
||||||
"attributes": "Stats",
|
"attributes": "Stats",
|
||||||
"attributeAllocation": "Stat Allocation",
|
"attributeAllocation": "Stat Allocation",
|
||||||
"attributeAllocationHelp": "Stat allocation is an option that provides methods for Habitica to automatically assign an earned Stat Point to a Stat immediately upon level-up. <br/><br/> You can adjust how Automatic Allocation is handled from the Stats section of your profile.",
|
"attributeAllocationHelp": "Stat allocation is an option that provides methods for Habitica to automatically assign an earned Stat Point to a Stat immediately upon level-up. <br/><br/> You can set your Automatic Allocation method to Task Based in the Stats section of your profile.",
|
||||||
"progress": "Progress",
|
"progress": "Progress",
|
||||||
"daily": "Daily",
|
"daily": "Daily",
|
||||||
"dailies": "Dailies",
|
"dailies": "Dailies",
|
||||||
|
|||||||
@@ -144,7 +144,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', 'collapseChecklist', 'alias', 'yesterDaily']);
|
return _.pick(initialSanitization, ['streak', 'checklist', 'attribute', 'reminders', 'tags', 'notes', 'collapseChecklist', 'alias', 'yesterDaily', 'counterDown', 'counterUp']);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Sanitize checklist objects (disallowing id)
|
// Sanitize checklist objects (disallowing id)
|
||||||
|
|||||||
Reference in New Issue
Block a user