Skip to content

Commit

Permalink
Aftral[premieroctet#51] moved comment logic from preput to precreate
Browse files Browse the repository at this point in the history
  • Loading branch information
SeghirOumo committed Aug 14, 2024
1 parent 468aa9e commit 6b97ce2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions backend/web/server/plugins/aftral-lms/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ const preCreate = async ({model, params, user}) => {
params.sender=params.creator
params.receiver=params.parent
}
if (model == 'comment'){
console.log(params)
params.user = user._id
params.post = params.parent
}
return Promise.resolve({model, params})
}

Expand Down Expand Up @@ -226,10 +231,6 @@ const prePut = async ({model, id, params, user, skip_validation}) => {
}
)}
}
if (model == 'comment'){
params.author = user._id
params.post = params.parent
}
return {model, id, params, user, skip_validation}
}

Expand Down

0 comments on commit 6b97ce2

Please sign in to comment.