Skip to content

Commit

Permalink
corrected my stupid merge...
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Sep 8, 2017
1 parent 3f89aed commit 6c967f8
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions server/routes/editLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const { getAccessMonitoringPaths } = require('../lib/schemas')
const mongoose = require('mongoose')
const _ = require('lodash')

const async = require('async')
const debug = require('debug')('isari:EditLog')

const ObjectId = mongoose.Types.ObjectId
Expand Down Expand Up @@ -342,32 +341,12 @@ const getAccessMonitorings = (model, formattedDiff) => {
paths = getAccessMonitoringPaths('activity')
else
paths = getAccessMonitoringPaths(model)

const modified = Object.keys(flatten(data))
let result = new Set()
Object.keys(paths)
.filter(path => modified.some(subpath => (subpath + '.').startsWith(path + '.')))
.forEach(path => result.add(paths[path]))
debug(result)
return Array.from(result)
}

const getAccessMonitoringsFromDiff = (model, formattedDiff) => {
let paths = []
if (model === 'organizations')
paths = getAccessMonitoringPaths('organization')
else
if (model === 'activities')
paths = getAccessMonitoringPaths('activity')
else
paths = getAccessMonitoringPaths(model)

let result = new Set()
Object.keys(paths).forEach(path => formattedDiff.forEach(change => {
if ((change.path.join('.') + '.').startsWith(path + '.')) {
result.add(paths[path])
}
}))
debug(result)
return Array.from(result)
}

0 comments on commit 6c967f8

Please sign in to comment.