Add support for after_success and after_failure to email notifications

This allows you to restrict email notifications to only be sent after the build changes from success to failure or failure to success.  It errs on the side of sending the notification; if the build is in another state (hung, for instance) or there was no previous build on the branch the email will also be sent.

Since the notify plugin shouldn't really have any responsibility for querying the database to find the previous commit's status, we store it on the commit when we save it.
Change from notification `after_success` and `after_failure` to `change`

Also removes the extra db field; instead, just send Prior as part of the Request.

This reverts commit e8b993e7dacf9c5fd018ed41f24ae9344e587be7.
no longer need to limit Prior commit to those that have status Success or Failure
Merge pull request #774 from movableink/notify-after-failure-after-success

Add support for after_success and after_failure to email notifications