LT-117: Remove the user from reviewers when session timeout

This commit is contained in:
Aysel Afsar 2016-04-04 11:06:14 -04:00
parent 8ee2eaf644
commit feb7f0972c
3 changed files with 13 additions and 2 deletions

View File

@ -62,7 +62,9 @@ Template.lesionTrackerLayout.onCreated(function() {
clearInterval(handle);
// Close the dialog
dialog.css('display', 'none');
// Remove reviewers info for the user
Meteor.call('removeUserFromReviewers', Meteor.userId());
}
});
});

View File

@ -89,7 +89,7 @@ WorklistTabs.find().observe({
removed: function(tab) {
var contentId = tab.contentid;
var timepointIds = ViewerData[contentId].timepointIds;
if (timepointIds.length > 0) {
if (timepointIds && timepointIds.length > 0) {
timepointIds.forEach(function(timepointId) {
// Remove the current user from Reviewers
Meteor.call('removeReviewer', timepointId);

View File

@ -1,5 +1,8 @@
Meteor.methods({
setReviewer: function (studyInstanceUid) {
if (!studyInstanceUid) {
return;
}
var study = Studies.findOne({
studyInstanceUid: studyInstanceUid
});
@ -45,6 +48,9 @@ Meteor.methods({
},
removeReviewer: function (timepointId) {
if (!timepointId) {
return;
}
var reviewerTimepoint = Reviewers.findOne({timepointId: timepointId});
if (!reviewerTimepoint || !reviewerTimepoint.reviewers) {
return;
@ -58,6 +64,9 @@ Meteor.methods({
},
removeUserFromReviewers: function(userId) {
if (!userId) {
return;
}
Reviewers.find().map(function (timepoint) {
Reviewers.update({_id: timepoint._id}, {"$pull": {"reviewers": {"userId": userId}}});
});