learning-unlimited/ESP-Website — pull request #742 by jmoldow (2013-10-08 07:15:08+00:00)
Title: Fixes some editclass logic.

I found this old commit on my local git repository. Not sure why I never had it merged, but it looks like none of the changes have been made, and they still seem relevant. This change needs testing though.

* The user isn't necessarily a teacher of the class (might be an admin),
and the user doesn't need to be added as a teacher (the user is either a
current teacher or an admin). So have ClassCreationController.editclass()
take a current_user argument, rather than a user argument.

* Do not call ClassCreationController.force_availability(). The editing user
is either an admin (whose availability is irrelivant / shouldn't be edited),
or a teacher who (in theory) already indicated availability.

* Call ClassCreationController.require_teacher_has_time() for all teachers
of the class, rather than the current user (who might not be a teacher)
and only the current user.

* Allows ClassCreationController.make_class_happen() to be called without
a user, since we don't need to associate a user with the class if the user
is already a teacher of the class.

* Have ClassCreationController.require_teacher_has_time() take a current_user
argument, so that different messages can be displayed depending on
whether the teacher violoating the time constraint is the current user or
a different teacher.