diff --git a/routes/api/queue/index.js b/routes/api/queue/index.js index 4c87d6593..82147853f 100644 --- a/routes/api/queue/index.js +++ b/routes/api/queue/index.js @@ -16,7 +16,7 @@ const router = express.Router(); router.get('/comments/pending', (req, res, next) => { Setting.getModerationSetting().then(function({moderation}){ let moderationValue = req.query.moderation; - if (typeof moderationValue === 'undefined' || moderationValue === undefined) { + if (typeof moderationValue === 'undefined' || !moderationValue) { moderationValue = moderation; } Comment.moderationQueue(moderationValue).then((comments) => { diff --git a/transfer.py b/transfer.py deleted file mode 100644 index 97a73a429..000000000 --- a/transfer.py +++ /dev/null @@ -1,49 +0,0 @@ -from pymongo import MongoClient -import requests - -url = 'http://localhost:3000/api/v1/' -url_asset = '%sasset' % url -url_comment = '%scomments' % url - -def main(): - client = MongoClient('localhost', 27017) - db_wapo = client.original_wapo - wcomments = db_wapo.comments - - for comment in wcomments.find(): - ncomment = {} - nasset = {} - status = comment['object']['status'] - if (status == 'Untouched'): - ncomment['status'] = '' - elif (status == 'CommunityFlagged'): - ncomment['status'] = '' - elif (status == 'ModeratorApproved'): - ncomment['status'] = 'accepted' - elif (status == 'ModeratorDeleted'): - ncomment['status'] = 'rejected' - ncomment['body'] = comment['object']['content'] - nasset['url'] = comment['targets'][0]['conversationID'] - ncomment['asset_id'] = post_asset(nasset) - ncomment['author_id'] = '1' - post_comment(ncomment) - -def post_asset(nasset): - print 'Posting %s into %s.' % (nasset, url_asset) - try: - r = requests.put(url_asset, json=nasset) - if 'id' in r.json(): - return r.json()['id'] - else: - ra = requests.get(url_asset, { url: nasset['url']}) - return ra.json()['id'] - except: - print('Error when getting asset.') - return 'asset' - -def post_comment(ncomment): - print 'Posting %s into %s.' % (ncomment, url_comment) - r = requests.post(url_comment, json=ncomment) - -if __name__ == '__main__': - main()