gitlabhq/gitlabhq — pull request #1680 by robbkidd (2012-10-11 17:45:34+00:00)
Title: Reduce complexity: replace case statement with method lookup.

Code climate gave `NoteObserver` a "B" because of the complex `notify_team_of_new_note` method that used a case statement. According to straight code analysis, this change halves the complexity of the method.

A concrete benefit of this change is that it reduces the number of code changes needed to add an email notification to a `Note` on a new model--or, say, `Snippet` with no email currently implemented. One would only have to make changes to `Notify` (add a `note_snippet_email` method and view) and update the tests for this method. No further change needed within the method itself.