Skip to content

Commit

Permalink
create and delete edits treated as updates relates #429
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Aug 30, 2017
1 parent 1f29495 commit 2e8e882
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions server/routes/editLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,19 @@ function getEditLog(req, res){
})
}
else{
edit.diff=[{
editType: d.action
}]
edit.diff = []
// in case of create or delete diff data is stored in data
// we filter tecnical fields
const data = _.omit(d.data,editLogsDataKeysBlacklist)
// sotred in value After or Before as other diffs
edit.diff[0][d.action === 'create' ? 'valueAfter' : 'valueBefore'] = data
_.forOwn(data, (value,key) => {
const diff = {
editType: d.action,
path: key
}
// store in value After or Before as other diffs
diff[d.action === 'create' ? 'valueAfter' : 'valueBefore'] = value
edit.diff.push(diff)
})
}

if (edit.diff.length === 0){
Expand Down

0 comments on commit 2e8e882

Please sign in to comment.