mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
Added fields for more approver details
This commit is contained in:
@@ -59,5 +59,7 @@ describe('POST /tasks/:id/approve/:userId', () => {
|
||||
let syncedTask = find(memberTasks, findAssignedTask);
|
||||
|
||||
expect(syncedTask.approved).to.be.true;
|
||||
expect(syncedTask.approvingUser).to.equal(user._id);
|
||||
expect(syncedTask.approvedDate).to.be.a('string'); // date gets converted to a string as json doesn't have a Date type
|
||||
});
|
||||
});
|
||||
|
||||
@@ -219,6 +219,8 @@ api.approveTask = {
|
||||
|
||||
if (group.leader !== user._id) throw new NotAuthorized(res.t('onlyGroupLeaderCanEditTasks'));
|
||||
|
||||
task.approvedDate = new Date();
|
||||
task.approvingUser = user._id;
|
||||
task.approved = true;
|
||||
await task.save();
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export let TaskSchema = new Schema({
|
||||
requiresApproval: {type: Boolean, default: false},
|
||||
approved: {type: Boolean, default: false},
|
||||
approvedDate: {type: Date},
|
||||
approvingUser: [{type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']}],
|
||||
approvingUser: {type: String, ref: 'User', validate: [validator.isUUID, 'Invalid uuid.']},
|
||||
approvalRequested: {type: Boolean, default: false},
|
||||
approvalRequestedDate: {type: Date},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user