Repository: mozilla/send
File: frontend/src/upload.js (JavaScript)

Code before:
      // The file is being encrypted
      if (isStillEncrypting) {
        document.l10n.formatValue('encryptingFile').then(encryptingFile => {
          $('.progress-text').text(encryptingFile);
        });
      } else {
        console.log('Finished encrypting');
        uploadStart = Date.now();
      }
    });

    let t;
    const startTime = Date.now();
    const unexpiredFiles = storage.numFiles + 1;

    // record upload-started event by sender
    sendEvent('sender', 'upload-started', {
      cm1: file.size,
      cm5: storage.totalUploads,
      cm6: unexpiredFiles,
      cm7: storage.totalDownloads,
      cd1: event.type === 'drop' ? 'drop' : 'click',
      cd5: window.referrer
    });

    // For large files we need to give the ui a tick to breathe and update
    // before we kick off the FileSender
    setTimeout(() => {
      //don't allow drag and drop when not on page-one
      fileSender
        .upload()
        .then(info => {
          const endTime = Date.now();
          const totalTime = endTime - startTime;
          const uploadTime = endTime - uploadStart;
          const uploadSpeed = file.size / (uploadTime / 1000);

          // record upload-stopped (completed) by sender
          sendEvent('sender', 'upload-stopped', {
            cm1: file.size,
            cm2: totalTime,
            cm3: uploadSpeed,
            cm5: storage.totalUploads,
            cm6: unexpiredFiles,
            cm7: storage.totalDownloads,
            cd1: event.type === 'drop' ? 'drop' : 'click',
            cd2: 'completed'
          });

          const fileData = {
            name: file.name,

Review comment (suggestion):
can you put this comment back with the code it belongs to:
` $('body').off('drop', onUpload);` line 166

Code after:
          $('.progress-text').text(encryptingFile);
        });
      } else {
        console.log('Finished encrypting');
        uploadStart = Date.now();
      }
    });

    let t;
    const startTime = Date.now();
    const unexpiredFiles = storage.numFiles + 1;

    // record upload-started event by sender
    sendEvent('sender', 'upload-started', {
      cm1: file.size,
      cm5: storage.totalUploads,
      cm6: unexpiredFiles,
      cm7: storage.totalDownloads,
      cd1: event.type === 'drop' ? 'drop' : 'click',
      cd5: window.referrer
    });

    // For large files we need to give the ui a tick to breathe and update
    // before we kick off the FileSender
    setTimeout(() => {
      fileSender
        .upload()
        .then(info => {
          const endTime = Date.now();
          const totalTime = endTime - startTime;
          const uploadTime = endTime - uploadStart;
          const uploadSpeed = file.size / (uploadTime / 1000);
          const expiration = 24 * 60 * 60 * 1000; //will eventually come from a field

          // record upload-stopped (completed) by sender
          sendEvent('sender', 'upload-stopped', {
            cm1: file.size,
            cm2: totalTime,
            cm3: uploadSpeed,
            cm5: storage.totalUploads,
            cm6: unexpiredFiles,
            cm7: storage.totalDownloads,
            cd1: event.type === 'drop' ? 'drop' : 'click',
            cd2: 'completed'
          });

          const fileData = {
            name: file.name,
            size: file.size,
            fileId: info.fileId,
            url: info.url,