diff --git a/services/web/scripts/beta-users/set_rich_text_beta_users.js b/services/web/scripts/beta-users/set_rich_text_beta_users.js deleted file mode 100644 index 84bf1546a9..0000000000 --- a/services/web/scripts/beta-users/set_rich_text_beta_users.js +++ /dev/null @@ -1,50 +0,0 @@ -const fs = require('fs') -const path = require('path') -const mongojs = require('../../app/src/infrastructure/mongojs') -const { db, ObjectId } = mongojs -const async = require('async') - -console.log('Finding users for ids specified') - -const text = fs.readFileSync(path.join(__dirname, 'beta-users.txt')) -const textByLine = text - .toString() - .split('\n') - .map(function(stringId) { - return ObjectId(stringId) - }) - -db.users.find({ _id: { $in: textByLine } }, function(err, users) { - if (err) throw err - - if (users.length) { - console.log('Found ' + users.length + ' users') - - async.each( - users, - function(user, callback) { - console.log('setting betaProgram==true for: ' + user._id) - db.users.update( - { - _id: user._id - }, - { - $set: { - betaProgram: true - } - }, - callback - ) - }, - function(result, err) { - if (err) { - console.log(err) - } - process.exit(0) - } - ) - } else { - console.log('No users found matching those ids') - process.exit(0) - } -}) diff --git a/services/web/scripts/dropbox/remove_duplicate_uids.js b/services/web/scripts/dropbox/remove_duplicate_uids.js deleted file mode 100644 index 6e39c189e8..0000000000 --- a/services/web/scripts/dropbox/remove_duplicate_uids.js +++ /dev/null @@ -1,72 +0,0 @@ -const { db } = require('../../app/src/infrastructure/mongojs') -const DropboxHandler = require('../../modules/dropbox/app/src/DropboxHandler') -const EmailHandler = require('../../app/src/Features/Email/EmailHandler') -const async = require('async') -const minimist = require('minimist') - -const argv = minimist(process.argv.slice(2)) -const commit = argv.commit !== undefined - -if (!commit) { - console.log('DOING DRY RUN. TO SAVE CHANGES PASS --commit') -} - -db.users.aggregate( - [ - { - $group: { - // group by Dropbox access token uid and count distinct users - _id: '$dropbox.access_token.uid', - count: { $sum: 1 }, - _ids: { $addToSet: '$_id' } - } - }, - { - $match: { - // select only uids userd more than once - _id: { $ne: null }, - count: { $gt: 1 } - } - }, - { - $project: { - // filter output - _id: false, - dropbox_uid: '$_id', - _ids: '$_ids' - } - } - ], - { allowDiskUse: true }, - function(error, results) { - if (error) throw error - console.log('FOUND ' + results.length + ' DUPLICATES') - async.mapSeries(results, removeDuplicates, function(error) { - if (error) throw error - console.log('DONE') - process.exit() - }) - } -) - -function removeDuplicates(duplicate, callback) { - async.mapSeries(duplicate._ids, unlinkUser, function(error) { - callback(error) - }) -} - -function unlinkUser(_id, callback) { - db.users.findOne({ _id: _id }, function(error, user) { - if (error) return callback(error) - console.log('UNLINKING USER ' + _id + ' (' + user.email + ')') - if (!commit) return callback() - DropboxHandler.unlinkAccount(_id, function(error) { - if (error) return callback(error) - EmailHandler.sendEmail( - 'dropboxUnlinkedDuplicate', - { to: user.email }, - callback - ) - }) - }) -} diff --git a/services/web/scripts/remove_duplicate_v1_ids.js b/services/web/scripts/remove_duplicate_v1_ids.js deleted file mode 100644 index d7df8ee388..0000000000 --- a/services/web/scripts/remove_duplicate_v1_ids.js +++ /dev/null @@ -1,59 +0,0 @@ -const { db } = require('../app/src/infrastructure/mongojs') -const async = require('async') -const minimist = require('minimist') - -const argv = minimist(process.argv.slice(2)) -const commit = argv.commit !== undefined - -if (!commit) { - console.log('DOING DRY RUN. TO SAVE CHANGES PASS --commit') -} - -db.users.aggregate( - [ - { $match: { 'overleaf.id': { $exists: true } } }, - { $group: { _id: '$overleaf.id', count: { $sum: 1 } } }, - { $match: { count: { $gt: 1 } } } - ], - { allowDiskUse: true }, - function(err, results) { - if (err) throw err - console.log('FOUND ' + results.length + ' DUPLICATES') - async.mapSeries(results, removeDuplicates, function(err) { - if (err) throw err - console.log('DONE') - process.exit() - }) - } -) - -function removeDuplicates(duplicate, callback) { - db.users.findOne({ 'overleaf.id': duplicate._id }, function(err, keepUser) { - if (err) throw err - console.log('KEEPING USER ' + keepUser._id + ' FOR OL ' + duplicate._id) - db.users.find( - { 'overleaf.id': duplicate._id, _id: { $ne: keepUser._id } }, - function(err, duplicateUsers) { - if (err) throw err - async.mapSeries( - duplicateUsers, - function(user, cb) { - console.log( - 'UNLINKING USER ' + user._id + ' FOR OL ' + duplicate._id - ) - if (!commit) return cb() - db.users.update( - { _id: user._id }, - { $unset: { 'overleaf.id': '' } }, - cb - ) - }, - function(err) { - if (err) throw err - callback() - } - ) - } - ) - }) -} diff --git a/services/web/transform-lodash-global.sh b/services/web/transform-lodash-global.sh deleted file mode 100755 index e2f81aaca1..0000000000 --- a/services/web/transform-lodash-global.sh +++ /dev/null @@ -1,40 +0,0 @@ -npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --ignore-pattern frontend/js/vendor \ - --noSemi=true \ - frontend/js - -npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --noSemi=true \ - test/frontend - -for MODULE in admin-panel cms dropbox git-bridge github-sync launchpad metrics open-in-overleaf overleaf-integration portals references-search support templates tpr-webmodule two-factor-authentication v2-templates -do - npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --noSemi=true \ - modules/$MODULE/frontend/js -done - -npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --noSemi=true \ - modules/rich-text/frontend/js - -npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --noSemi=true \ - modules/rich-text/test/frontend - -npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --noSemi=true \ - modules/publish-modal/frontend/js - -npx jscodeshift \ - -t https://gist.githack.com/40thieves/0b495af3fb0ad5fe08915ce5159a2b7b/raw/9c583c0a5b0cbd83a66538a07591b41332efda6a/transform-lodash.js \ - --noSemi=true \ - modules/publish-modal/test/frontend - -make format_fix \ No newline at end of file