Skip to content
Snippets Groups Projects
Commit 9da6a28d authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

fix(getCollections): strip duplicate collections for authors

parent 0918dc26
No related branches found
No related tags found
3 merge requests!108Hin 858 revision fix,!106Hin 858,!97HIN-858
const { last, get } = require('lodash')
const filterDuplicates = collection =>
get(collection, 'currentVersion.id') === last(collection.fragments)
const { const {
authsome: authsomeHelper, authsome: authsomeHelper,
} = require('pubsweet-component-helper-service') } = require('pubsweet-component-helper-service')
...@@ -16,5 +21,5 @@ module.exports = models => async (req, res) => { ...@@ -16,5 +21,5 @@ module.exports = models => async (req, res) => {
}) })
} }
res.status(200).json(collections) res.status(200).json(collections.filter(filterDuplicates))
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment