Separate observing of Note and MergeRequests
Created by: robbkidd
It's been awhile since I tackled the observers. Note and MergeRequest had not seen any love yet and were still mashed together in MailerObserver. Here is my latest on fixing that with separate observers for Note and MergeRequest.
-
Move
is_assigned?andis_being_xx?methods toIssueCommonalityThis is behavior merge requests have in common with issues. Moved methods to
IssueCommonalityrole. Put specs directly intomerge_request_spec.rbbecause setup differs for issues and MRs specifically in the "closed" factory to use. -
Add
MergeRequestObserver. ParallelsIssueObserverin almost every way.Ripe for refactoring, but tricky because of the different mailer methods and views.
-
Rename
MailerObservertoNoteObserverWith merge request observing moved out of
MailerObserver, all that was left wasNotelogic. Renamed toNoteObserver, added tests and updated application config for new observer names. RefactoredNoteObserverto use the note's author and not rely oncurrent_user. -
Set
current_userforMergeRequestObserverIssueObserverandMergeRequestObserverare the only observers that need a reference to thecurrent_userthat they cannot look up on the objects they are observing.