0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 15:03:07 +00:00

Small bug causing crashes with Tags (#1152)

Also: Force Google to always send to trash instead of fully deleting.

Remove unneeded console.logs to speed up server.
This commit is contained in:
Trevor Buckner
2020-12-11 16:18:28 -05:00
committed by GitHub
parent e127855d84
commit 980fdf5ad1

View File

@@ -73,8 +73,6 @@ GoogleActions = {
console.error(err); console.error(err);
}); });
console.log('created new drive folder with ID:');
console.log(obj.data.id);
folderId = obj.data.id; folderId = obj.data.id;
} else { } else {
folderId = obj.data.files[0].id; folderId = obj.data.files[0].id;
@@ -149,13 +147,7 @@ GoogleActions = {
updateGoogleBrew : async (auth, brew)=>{ updateGoogleBrew : async (auth, brew)=>{
const drive = google.drive({ version: 'v3', auth: auth }); const drive = google.drive({ version: 'v3', auth: auth });
console.log('trying to update a brew');
console.log(brew);
if(await GoogleActions.existsGoogleBrew(auth, brew.googleId) == true) { if(await GoogleActions.existsGoogleBrew(auth, brew.googleId) == true) {
console.log('the brew exists at least');
console.log('going to put this text:');
console.log(brew.text);
await drive.files.update({ await drive.files.update({
fileId : brew.googleId, fileId : brew.googleId,
resource : { name : `${brew.title}.txt`, resource : { name : `${brew.title}.txt`,
@@ -282,7 +274,7 @@ GoogleActions = {
text : file.data, text : file.data,
description : obj.data.description, description : obj.data.description,
tags : obj.data.properties.tags ? obj.data.properties.tags.split(',') : [], tags : obj.data.properties.tags ? obj.data.properties.tags : '',
systems : obj.data.properties.systems ? obj.data.properties.systems.split(',') : [], systems : obj.data.properties.systems ? obj.data.properties.systems.split(',') : [],
authors : [], authors : [],
published : obj.data.properties.published ? obj.data.properties.published == 'true' : false, published : obj.data.properties.published ? obj.data.properties.published == 'true' : false,
@@ -323,8 +315,9 @@ GoogleActions = {
throw ('Not authorized to delete this Google brew'); throw ('Not authorized to delete this Google brew');
} }
await drive.files.delete({ await drive.files.update({
fileId : googleId fileId : googleId,
resource : { trashed: true }
}) })
.catch((err)=>{ .catch((err)=>{
console.log('Can\'t delete Google file'); console.log('Can\'t delete Google file');