Consolidate functionality shared between Issue and MergeRequest
Created by: rspeicher
Summary
Any associations, validations, delegates, scopes and methods that were exactly the same in both Issue and MergeRequest models have been moved to a new IssueCommonality module (role) that gets included by each class.
There was actually quite a bit of duplication, because MergeRequests are basically just specialized Issues.
"IssueCommonality"?
I had a bit of a hard time coming up with a name for the module, and I'm still not entirely satisfied with it, but I think it does a good enough job of describing what it does without being too verbose.
commonality |ˌkämənˈalitē| noun ( pl. commonalities ) 1 the state of sharing features or attributes: a commonality of interest ensures cooperation.
Specs?
First, there's probably now a bit of duplication in the model specs for these two classes, but I haven't done anything with that yet.
Second, I was unable to get a full development environment running that actually passed all the tests before I made these changes. I did run the two model specs, and those passed, but a quick "Developer Bootstrap" guide on the wiki or something would be much appreciated, and probably get the project some more contributors.
Merge request reports
Activity
31 :length => { :within => 0..255 } 32 8 33 9 validates :description, 34 10 :length => { :within => 0..2000 } 35 11 36 scope :opened, where(:closed => false) 37 scope :closed, where(:closed => true) 38 scope :assigned, lambda { |u| where(:assignee_id => u.id)} 39 40 12 acts_as_list 41 13 42 14 def self.open_for(user) 43 15 opened.assigned(user) 44 16 end 45 17 46 def self.search query