From ffc204c1bf39241ad2158fe349e3d7be77e177ef Mon Sep 17 00:00:00 2001 From: Steve Oney Date: Thu, 16 Mar 2017 11:36:30 -0400 Subject: [PATCH] added private uid to page --- lib/requests/services/recorder.js | 2 - lib/requests/services/upload_recording.js | 4 +- lib/requests/services/upload_textrequest.js | 135 +------------------- 3 files changed, 7 insertions(+), 134 deletions(-) diff --git a/lib/requests/services/recorder.js b/lib/requests/services/recorder.js index 4c89b0b..6ecf1a9 100644 --- a/lib/requests/services/recorder.js +++ b/lib/requests/services/recorder.js @@ -31,7 +31,6 @@ module.exports = function(app) { } }, start: function(title, tags) { - ; if (!this.isRecording()) { this.setRecording(true); uid = guid(); @@ -63,7 +62,6 @@ module.exports = function(app) { }, sendingTextRequest: function(title, request, tags){ uid = guid(); - ; cwd = FileRecorder.start(uid); var scope = angular.element(document.querySelector('#makeRequest')).scope(); setTimeout(function() { diff --git a/lib/requests/services/upload_recording.js b/lib/requests/services/upload_recording.js index b4279bc..dfee742 100644 --- a/lib/requests/services/upload_recording.js +++ b/lib/requests/services/upload_recording.js @@ -5,6 +5,7 @@ var fs = require('fs'); var path = require('path'); var FormData = require('form-data'); var _ = require('underscore') +var guid = require('../../utils/guid'); module.exports = function(app) { var changelog; @@ -31,6 +32,7 @@ module.exports = function(app) { title: requestTitle, tags: requestTags, question_id: uid, + private_id: guid(), editor_id: prefs.getEditorID(), transcript: "worked", changelog: changelog, @@ -39,7 +41,7 @@ module.exports = function(app) { //add gutter icon to indicate the location, which should be the same as showlocation var editor = atom.workspace.getActiveTextEditor(); - ; + _.every(changelog, function(obj) { if (obj.type == 'cursor') { editor.scrollToScreenPosition(obj.cursor, { diff --git a/lib/requests/services/upload_textrequest.js b/lib/requests/services/upload_textrequest.js index 4e0a020..a52bd7b 100644 --- a/lib/requests/services/upload_textrequest.js +++ b/lib/requests/services/upload_textrequest.js @@ -4,27 +4,27 @@ var fs = require('fs'); var path = require('path'); var FormData = require('form-data'); var _ = require('underscore') +var guid = require('../../utils/guid'); module.exports = function(app){ app.factory('UploadTextRequest', ['STORAGE_DIRECTORY','EditorRecorder','Slack', function(STORAGE_DIRECTORY, EditorRecorder, Slack){ return function(uid, cwd, title, request, tags, workspaceSnapshot){ - console.log(uid, cwd, title, request, tags); var folder = path.join(STORAGE_DIRECTORY, uid); var filename = 'recording.json', fullFilename = path.join(folder, filename); - EditorRecorder.start(uid, cwd); + // EditorRecorder.start(uid, cwd); EditorRecorder.stop(uid).then(function(info){ var recordingInfo = { title: title, request_description: request, tags: tags, question_id: uid, + private_id: guid(), editor_id: prefs.getEditorID(), transcript: "worked", changelog: info, cwd: cwd }; - ; return pfs.mkdirp(folder).then(function() { ; return pfs.writeJson(fullFilename, recordingInfo).then(function() { @@ -64,131 +64,4 @@ module.exports = function(app){ }); } }]); -} - - - - - - - - -// -// -// -// -// -// -// -// -// var pfs = require('../../utils/promised_fs'); -// var prefs = require('../../utils/user_preferences'); -// //var angular = require('angular'); -// var fs = require('fs'); -// var path = require('path'); -// var FormData = require('form-data'); -// var _ = require('underscore') -// -// module.exports = function(app) { -// var changelog; -// app.factory('UploadTextRequest', ['$q', '$rootScope', 'STORAGE_DIRECTORY', 'Slack', function($q, $rootScope, STORAGE_DIRECTORY, Slack) { -// return function(uid, editorRecorder, voiceRecorder, workspaceSnapshot, cwd, requestTitle) { -// var changelogPromise = editorRecorder.stop(uid); -// var promises = voiceRecorder.stop(uid), -// wavPromise = promises; -// -// var wavFilePromise = wavPromise.then(function(wavFilename) { -// console.log("wavPromise : " + wavFilename); -// workspaceSnapshot.addFile(wavFilename, path.basename(wavFilename)); -// }); -// var folder = path.join(STORAGE_DIRECTORY, uid); -// var skype = prefs.getContact(); -// if (requestTitle == null) { -// requestTitle = 'This person is too lazy to leave anything ...' -// } -// changelogPromise.then(function(info) { -// -// var changelog = info; -// var recordingInfo = { -// contact: skype, -// title: requestTitle, -// question_id: uid, -// editor_id: prefs.getEditorID(), -// transcript: "worked", -// changelog: changelog, -// cwd: cwd -// }; -// -// //add gutter icon to indicate the location, which should be the same as showlocation -// var editor = atom.workspace.getActiveTextEditor(); -// ; -// _.every(changelog, function(obj) { -// if (obj.type == 'cursor') { -// editor.scrollToScreenPosition(obj.cursor, { -// center: true -// }); -// editor.setCursorScreenPosition(obj.cursor); -// return false; -// } -// -// if (obj.type == 'selection_range') { -// editor.scrollToScreenPosition(obj.range[0], { -// center: true -// }); -// editor.setCursorScreenPosition(obj.range[0]); -// return false; -// } -// -// return true; -// }); -// -// var filename = 'recording.json', -// fullFilename = path.join(folder, filename); -// -// return pfs.mkdirp(folder).then(function() { -// ; -// return pfs.writeJson(fullFilename, recordingInfo).then(function() { -// return workspaceSnapshot.addFile(fullFilename, filename); -// }); -// }); -// }); -// -// return Promise.all([wavFilePromise, changelogPromise]).then(function() { -// console.log("transcript(wavFilePromise, infoPromise) : "); -// -// return workspaceSnapshot.stop(uid); -// }).then(function(zipFilename) { -// console.log("transcript(wavFilePromise, infoPromise)2 : "); -// -// return pfs.remove(folder).then(function() { -// return zipFilename; -// }); -// }).then(function(zipFilename) { -// console.log("Wrote to " + zipFilename); -// var form = new FormData(); -// form.append('recording', fs.createReadStream(zipFilename)); -// return new Promise(function(resolve, reject) { -// form.submit(prefs.getUploadURL(), function(err, result) { -// if (err) { -// reject(err); -// } else { -// resolve(zipFilename); -// } -// }); -// }); -// }).then(function(zipFilename) { -// return pfs.remove(zipFilename); -// }).then(function() { -// if (prefs.postRequestsToSlack()) { -// return Slack.postRequest(uid, requestTitle); -// } else { -// return; -// } -// }).then(function() { -// console.log("Uploaded to " + prefs.getUploadURL()); -// }, function(err) { -// console.error(err.stack); -// }); -// }; -// }]); -// }; +} \ No newline at end of file