Skip to content

Commit 3c771fc

Browse files
authored
Remove sendEmail method (#155)
* Remove sendEmail method Use sentry to capture exception instead.
1 parent 8810dd9 commit 3c771fc

15 files changed

Lines changed: 34 additions & 672 deletions

File tree

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ For example, if concokb-core runs at `http://localhost:8888/oncokb`, you should
4949
...
5050
```
5151

52-
## Testing
53-
For front-end, we use Karma and Jasmin to run unit test cases.
54-
1. Install karma-cli (globally).
55-
2. Copy /app/data/config.json to **OncoKB.config** in /app/scripts/app.spec.js.
56-
3. Run **karma start** at root folder.
57-
5852
## FAQs
5953
#### Can’t getAllUsers() because of the different rules set in Firebase. It still shows 'don’t have access...' after logging in successfully.
6054
Add rules to the database.

app/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@
199199
<script src="scripts/factories/TreeFactory.js"></script>
200200
<script src="scripts/factories/VariantFactory.js"></script>
201201
<script src="scripts/controllers/VariantCtrl.js"></script>
202-
<script src="scripts/controllers/emailDialogCtrl.js"></script>
203202
<script src="scripts/controllers/VUSCtrl.js"></script>
204203
<script src="scripts/filters/Filter.js"></script>
205204
<script src="scripts/directives/regularview.js"></script>

app/scripts/app.spec.js

Lines changed: 0 additions & 414 deletions
This file was deleted.

app/scripts/controllers/drugs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ angular.module('oncokbApp')
114114
}, function(reason) {
115115
// something goes wrong then the data in database should not be updated.
116116
});
117-
mainUtils.sendEmailtoMultipulUsers(['kundrar@mskcc.org', 'chakravd@mskcc.org', 'nissanm@mskcc.org'], 'Reminder: A therapy preferred name changed.', content);
118117
}
119118
}
120119
};

app/scripts/controllers/emailDialogCtrl.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/scripts/controllers/gene.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,18 +3387,7 @@ angular.module('oncokbApp')
33873387
}, function (error) {
33883388
// Something goes wrong, this needs to be stored into meta file for future update.
33893389
console.log('Failed to update priority.');
3390-
DatabaseConnector.sendEmail({
3391-
sendTo: 'dev.oncokb@gmail.com',
3392-
subject: 'Error when updating treatments\' priority',
3393-
content: JSON.stringify(postData)
3394-
},
3395-
function (result) {
3396-
deferred.rejected(error);
3397-
},
3398-
function (error) {
3399-
deferred.rejected(error);
3400-
}
3401-
);
3390+
Sentry.captureException(new Exception('Error when updating treatments\' priority. Data: ' + JSON.stringify(postData)));
34023391
});
34033392
} else {
34043393
deferred.resolve();

app/scripts/controllers/genes.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ angular.module('oncokbApp')
140140
rendering: true,
141141
queueRendering: true
142142
};
143-
$scope.adminEmails = [];
144143
$scope.oncoTree = {
145144
mainTypes: {}
146145
};

app/scripts/controllers/nav.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ angular.module('oncokbApp')
6262
$location.url('/genes');
6363
}
6464
}, function(error) {
65-
mainUtils.sendEmail('dev.oncokb@gmail.com', 'Failed to set user role.',
66-
'Content: \n' + JSON.stringify(firebaseUser) + '\n\nError: \n' + JSON.stringify(error));
65+
Sentry.captureException(new Exception('Failed to set user role. Content: \n' + JSON.stringify(firebaseUser) + '\n\nError: \n' + JSON.stringify(error)));
6766
});
6867
} else {
6968
console.log('not logged in yet');

app/scripts/directives/createnewdrug.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ angular.module('oncokbApp')
3636
$scope.addDrugErrorMessage = 'Failed to create the drug ' + drugName + '! Please contact developers.';
3737
deferred.reject(error);
3838
});
39-
mainUtils.sendEmailtoMultipulUsers(['kundrar@mskcc.org', 'chakravd@mskcc.org', 'nissanm@mskcc.org'], 'Reminder: A therapy has been added.', content);
4039
}
4140
else {
4241
$scope.addDrugErrorMessage = "Sorry, same drug exists.";

app/scripts/directives/curationQueue.js

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ angular.module('oncokbApp')
3434
formExpanded: false,
3535
editing: false,
3636
hugoVariantMapping: {},
37-
resendEmail: false,
3837
queueItemInEditing: '',
3938
invalidData: false,
4039
hugoSymbols: [],
4140
loading: true
4241
};
43-
scope.resendEmail = false;
4442
scope.input = {
4543
article: '',
4644
link: '',
@@ -83,7 +81,6 @@ angular.module('oncokbApp')
8381
});
8482
}
8583
scope.data.loading = false;
86-
scope.secondTimeAutoNotify();
8784
});
8885
// The column difference in terms of curation queue location in queues page or gene page it that,
8986
// gene page has an unique column 'Previously curated in', and queues page has an unique column 'Gene'
@@ -206,9 +203,6 @@ angular.module('oncokbApp')
206203
currentQueues.push(item);
207204
$scope.updateQueueInDB(hugoSymbol, currentQueues).then(function(result) {
208205
$scope.queue.push(item);
209-
if (item.curator) {
210-
$scope.sendEmail(item);
211-
}
212206
});
213207
}
214208
$scope.initialProcess = function(x, type) {
@@ -239,7 +233,6 @@ angular.module('oncokbApp')
239233
};
240234

241235
function editCuration(queueItem) {
242-
$scope.data.resendEmail = false;
243236
$scope.data.editing = true;
244237
$scope.data.queueItemInEditing = queueItem;
245238
$scope.data.modifiedCurator = {};
@@ -334,9 +327,6 @@ angular.module('oncokbApp')
334327
_.each(_.keys(item), function(key) {
335328
$scope.data.queueItemInEditing[key] = item[key];
336329
});
337-
if ($scope.resendEmail) {
338-
$scope.sendEmail(queueItem);
339-
}
340330
});
341331
}
342332
function completeCuration(queueItem) {
@@ -417,60 +407,6 @@ angular.module('oncokbApp')
417407
console.log('error');
418408
});
419409
};
420-
$scope.sendEmail = function(queueItem) {
421-
var expiredCuration = false;
422-
if ($scope.isExpiredCuration(queueItem.dueDay)) {
423-
expiredCuration = true;
424-
}
425-
var email = '';
426-
for (var i = 0; i < $scope.data.curators.length; i++) {
427-
if (queueItem.curator === $scope.data.curators[i].name) {
428-
email = $scope.data.curators[i].email;
429-
break;
430-
}
431-
}
432-
if (!email) return;
433-
var content = 'Dear ' + queueItem.curator.split(' ')[0] + ',\n\n';
434-
if (expiredCuration) {
435-
content += 'You have not completed curation of the assigned publication: ' + queueItem.article;
436-
if (queueItem.link) {
437-
content += '(' + queueItem.link + ')';
438-
}
439-
content += ' which was due on ' + $scope.getFormattedDate(queueItem.dueDay) + '. Please complete this assignment as soon as possible and let us know when you have done this. \n\nIf you have already completed this task, please remember to CLICK THE GREEN CHECK BOX BUTTON at the Curation Queue page or the bottom of the gene page (this will let us know the task is complete). If you have any questions or concerns please email or slack us as needed.';
440-
content += 'Thank you, \nOncoKB Admin';
441-
} else {
442-
content += queueItem.addedBy + ' of OncoKB would like you curate the following publications in the indicated alteration, tumor type and section:\n\n';
443-
var tempArr = [queueItem.article];
444-
if (queueItem.link) {
445-
tempArr = tempArr.concat(['(', queueItem.link, ')']);
446-
}
447-
if (queueItem.variant) {
448-
tempArr = tempArr.concat(['Alteration:', queueItem.variant + ',']);
449-
}
450-
if (queueItem.subType) {
451-
tempArr = tempArr.concat(['Tumor type:', queueItem.subType + ',']);
452-
}
453-
if (queueItem.section) {
454-
tempArr = tempArr.concat(['Section:', queueItem.section]);
455-
}
456-
content += tempArr.join(' ') + '\n';
457-
if (queueItem.comment) {
458-
content += queueItem.comment + '\n';
459-
}
460-
content += '\nPlease try to curate this literature before ' + $scope.getFormattedDate(queueItem.dueDay) + ' and remember to log your hours for curating this data.\n\n';
461-
content += 'IMPORTANT: Please remember to CLICK THE GREEN CHECK BOX BUTTON at the Curation Queue page or the bottom of the gene page (this will let us know the task is complete).\n\n';
462-
content += 'If you have any questions or concerns please email or slack ' + queueItem.addedBy + '.\n\n';
463-
content += 'Thank you, \nOncoKB Admin';
464-
}
465-
var subject = 'OncoKB Curation Assignment';
466-
mainUtils.sendEmail(email, subject, content).then(function() {
467-
if (expiredCuration) {
468-
setCurationNotified(queueItem);
469-
}
470-
}, function(error) {
471-
dialogs.error('Error', 'Failed to notify curator automatically. Please send curator email manually.');
472-
});
473-
};
474410

475411
var annotationLocation = $scope.specifyAnnotationInGene();
476412
$scope.getAnnotationLocation = function(x) {
@@ -513,7 +449,6 @@ angular.module('oncokbApp')
513449
$scope.data.editing = false;
514450
$scope.predictedArticle = '';
515451
$scope.validPMID = false;
516-
$scope.data.resendEmail = false;
517452
};
518453
$scope.isExpiredCuration = mainUtils.isExpiredCuration;
519454
$scope.checkInput = function() {
@@ -526,20 +461,8 @@ angular.module('oncokbApp')
526461
if ($scope.data.editing && !$scope.data.invalidData) {
527462
if ($scope.input.curator && queueItem.curator !== $scope.input.curator.name ||
528463
$scope.input.dueDay && queueItem.dueDay !== new Date($scope.input.dueDay).getTime()) {
529-
$scope.data.resendEmail = true;
530-
} else {
531-
$scope.data.resendEmail = false;
532464
}
533465
}
534-
$scope.resendEmail = $scope.data.resendEmail;
535-
};
536-
$scope.secondTimeAutoNotify = function() {
537-
_.each($scope.queue, function (queueItem) {
538-
var hugoSymbol = queueItem.hugoSymbol;
539-
if (hugoSymbol && queueItem.curator && !queueItem.curated && mainUtils.isExpiredCuration(queueItem.dueDay) && !queueItem.notified) {
540-
$scope.sendEmail(queueItem);
541-
}
542-
});
543466
};
544467
$scope.getQueuesByGene = function(hugoSymbol) {
545468
return $rootScope.firebaseQueues[hugoSymbol] ? angular.copy($rootScope.firebaseQueues[hugoSymbol].queue) : [];

0 commit comments

Comments
 (0)