Skip to content

Commit

Permalink
CoursesView: Should deselect courses on deletion #1430
Browse files Browse the repository at this point in the history
  • Loading branch information
ltwheeler committed Nov 15, 2017
1 parent 7ce7e2e commit 757d903
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/course/services/courseStateService.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,19 @@ courseApp.service('courseStateService', function ($rootScope, $log, Course, Term
uiState.massImportPrivate = false;
return uiState;
case REMOVE_COURSE:
var courseId = action.payload.course.id;
// Remove the details pane if it was showing the deleted course
if (uiState.selectedCourseId == action.payload.course.id) {
if (uiState.selectedCourseId == courseId) {
uiState.selectedCourseId = null;
}

// Ensure deleted course is not selected
var index = uiState.selectedCourseRowIds.indexOf(courseId);

if (index > -1) {
uiState.selectedCourseRowIds.splice(index, 1);
}

return uiState;
case TOGGLE_SELECT_COURSE_ROW:
var courseId = action.payload.courseId;
Expand Down

0 comments on commit 757d903

Please sign in to comment.