diff options
author | Robb Kidd <robb@thekidds.org> | 2012-10-10 02:25:29 +0400 |
---|---|---|
committer | Robb Kidd <robb@thekidds.org> | 2012-10-11 01:59:25 +0400 |
commit | 16ceae895e32c2474de04c42307d914bf9a4c304 (patch) | |
tree | aa3a0104064cd80e6716ec010257103b0e66f377 /app/roles | |
parent | 2b7fd29b1abb3ab6ca5ece7fe2b093f6672796d6 (diff) |
Separate observing of Note and MergeRequests
* Move is_assigned? and is_being_xx? methods to IssueCommonality
This is behavior merge requests have in common with issues. Moved
methods to IssueCommonality role. Put specs directly into
merge_request_spec because setup differs for issues and MRs
specifically in the "closed" factory to use.
* Add MergeRequestObserver. Parallels IssueObserver in almost every way.
Ripe for refactoring.
* Rename MailerObserver to NoteObserver
With merge request observing moved out of MailerObserver, all that
was left was Note logic. Renamed to NoteObserver, added tests and
updated application config for new observer names. Refactored
NoteObserver to use the note's author and not rely on current_user.
* Set current_user for MergeRequestObserver
IssueObserver and MergeRequestObserver are the only observers that
need a reference to the current_user that they cannot look up on
the objects they are observing.
Diffstat (limited to 'app/roles')
-rw-r--r-- | app/roles/issue_commonality.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/roles/issue_commonality.rb b/app/roles/issue_commonality.rb index 3d9074867b7..2d10bfec866 100644 --- a/app/roles/issue_commonality.rb +++ b/app/roles/issue_commonality.rb @@ -46,4 +46,21 @@ module IssueCommonality def new? today? && created_at == updated_at end + + def is_assigned? + !!assignee_id + end + + def is_being_reassigned? + assignee_id_changed? + end + + def is_being_closed? + closed_changed? && closed + end + + def is_being_reopened? + closed_changed? && !closed + end + end |