Skip to content
Snippets Groups Projects

Consolidate functionality shared between Issue and MergeRequest

Merged gitlab-qa-bot requested to merge github/fork/rspeicher/issue_commonality into master

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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
  • Created by: dzaporozhets

    You forgot about this method

    By Administrator on 2012-08-09T17:47:16 (imported from GitLab project)

    By Administrator on 2012-08-09T17:47:16 (imported from GitLab)

  • Created by: rspeicher

    Didn't forget, just made a derpy mistake. :blush:

    By Administrator on 2012-08-09T17:49:31 (imported from GitLab project)

    By Administrator on 2012-08-09T17:49:31 (imported from GitLab)

  • Created by: dzaporozhets

    great, merging it. thank you :)

    By Administrator on 2012-08-10T13:48:13 (imported from GitLab project)

    By Administrator on 2012-08-10T13:48:13 (imported from GitLab)

  • Please register or sign in to reply
    Loading