decaffeinate: Run post-processing cleanups on DocArchiveManager.coffee and 7 other files

This commit is contained in:
decaffeinate 2020-02-16 14:01:47 +00:00 committed by Simon Detheridge
parent afa2577381
commit d31a747c72
8 changed files with 57 additions and 8 deletions

View file

@ -1,3 +1,10 @@
/* eslint-disable
camelcase,
handle-callback-err,
no-useless-escape,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns

View file

@ -1,3 +1,12 @@
/* eslint-disable
camelcase,
handle-callback-err,
no-dupe-keys,
no-undef,
standard/no-callback-literal,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns

View file

@ -1,3 +1,9 @@
/* eslint-disable
no-proto,
no-unused-vars,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
let Errors; let Errors;
var NotFoundError = function(message) { var NotFoundError = function(message) {
const error = new Error(message); const error = new Error(message);

View file

@ -1,3 +1,9 @@
/* eslint-disable
camelcase,
standard/no-callback-literal,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns

View file

@ -1,3 +1,10 @@
/* eslint-disable
camelcase,
handle-callback-err,
valid-typeof,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from * DS101: Remove unnecessary use of Array.from
@ -150,7 +157,7 @@ module.exports = (HttpController = {
_buildDocView(doc) { _buildDocView(doc) {
const doc_view = { _id: (doc._id != null ? doc._id.toString() : undefined) }; const doc_view = { _id: (doc._id != null ? doc._id.toString() : undefined) };
for (let attribute of ["lines", "rev", "version", "ranges", "deleted"]) { for (const attribute of ["lines", "rev", "version", "ranges", "deleted"]) {
if (doc[attribute] != null) { if (doc[attribute] != null) {
doc_view[attribute] = doc[attribute]; doc_view[attribute] = doc[attribute];
} }
@ -164,7 +171,7 @@ module.exports = (HttpController = {
_buildDocsArrayView(project_id, docs) { _buildDocsArrayView(project_id, docs) {
const docViews = []; const docViews = [];
for (let doc of Array.from(docs)) { for (const doc of Array.from(docs)) {
if (doc != null) { // There can end up being null docs for some reason :( (probably a race condition) if (doc != null) { // There can end up being null docs for some reason :( (probably a race condition)
docViews.push(HttpController._buildDocView(doc)); docViews.push(HttpController._buildDocView(doc));
} else { } else {

View file

@ -1,3 +1,9 @@
/* eslint-disable
camelcase,
handle-callback-err,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns * DS102: Remove unnecessary code created because of implicit returns
@ -46,7 +52,7 @@ module.exports = (MongoManager = {
inS3: true inS3: true
} }
}; };
update.$set["project_id"] = ObjectId(project_id); update.$set.project_id = ObjectId(project_id);
return db.docs.update({_id: ObjectId(doc_id)}, update, {upsert: true}, callback); return db.docs.update({_id: ObjectId(doc_id)}, update, {upsert: true}, callback);
}, },
@ -64,9 +70,9 @@ module.exports = (MongoManager = {
$set: {}, $set: {},
$unset: {} $unset: {}
}; };
update.$set["inS3"] = true; update.$set.inS3 = true;
update.$unset["lines"] = true; update.$unset.lines = true;
update.$unset["ranges"] = true; update.$unset.ranges = true;
const query = { const query = {
_id: doc_id, _id: doc_id,
rev rev

View file

@ -1,3 +1,9 @@
/* eslint-disable
camelcase,
no-return-assign,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/* /*
* decaffeinate suggestions: * decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from * DS101: Remove unnecessary use of Array.from
@ -37,11 +43,11 @@ module.exports = (RangeManager = {
} }
}; };
for (let change of Array.from(ranges.changes || [])) { for (const change of Array.from(ranges.changes || [])) {
change.id = RangeManager._safeObjectId(change.id); change.id = RangeManager._safeObjectId(change.id);
updateMetadata(change.metadata); updateMetadata(change.metadata);
} }
for (let comment of Array.from(ranges.comments || [])) { for (const comment of Array.from(ranges.comments || [])) {
comment.id = RangeManager._safeObjectId(comment.id); comment.id = RangeManager._safeObjectId(comment.id);
if ((comment.op != null ? comment.op.t : undefined) != null) { if ((comment.op != null ? comment.op.t : undefined) != null) {
comment.op.t = RangeManager._safeObjectId(comment.op.t); comment.op.t = RangeManager._safeObjectId(comment.op.t);

View file

@ -1,3 +1,5 @@
// TODO: This file was created by bulk-decaffeinate.
// Sanity-check the conversion and remove this comment.
const Settings = require("settings-sharelatex"); const Settings = require("settings-sharelatex");
const mongojs = require("mongojs"); const mongojs = require("mongojs");
const db = mongojs(Settings.mongo.url, ["docs", "docOps"]); const db = mongojs(Settings.mongo.url, ["docs", "docOps"]);