Commit 82ae973a9909bd82d75ce493a0a151efa0a98621
1 parent
64db5f80
Exists in
master
and in
4 other branches
Describe for Roles
Showing
11 changed files
with
75 additions
and
3 deletions
Show diff stats
app/roles/account.rb
app/roles/authority.rb
app/roles/git_host.rb
app/roles/issue_commonality.rb
app/roles/namespaced_project.rb
| 1 | +# == NamespacedProject role | |
| 2 | +# | |
| 3 | +# Provides extra functionality for Project related to namespaces like: | |
| 4 | +# - transfer project between namespaces | |
| 5 | +# - name, path including namespece | |
| 6 | +# - project owner based on namespace | |
| 7 | +# | |
| 8 | +# Used by Project | |
| 9 | +# | |
| 1 | 10 | module NamespacedProject |
| 2 | 11 | def transfer(new_namespace) |
| 3 | 12 | Project.transaction do | ... | ... |
app/roles/note_event.rb
app/roles/push_event.rb
| 1 | +# == PushEvent role | |
| 2 | +# | |
| 3 | +# Extends Event model functionality by providing extra methods related to push events | |
| 4 | +# | |
| 5 | +# Used by Event | |
| 6 | +# | |
| 1 | 7 | module PushEvent |
| 2 | 8 | def valid_push? |
| 3 | 9 | data[:ref] |
| ... | ... | @@ -58,7 +64,7 @@ module PushEvent |
| 58 | 64 | @commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse |
| 59 | 65 | end |
| 60 | 66 | |
| 61 | - def commits_count | |
| 67 | + def commits_count | |
| 62 | 68 | data[:total_commits_count] || commits.count || 0 |
| 63 | 69 | end |
| 64 | 70 | |
| ... | ... | @@ -88,7 +94,7 @@ module PushEvent |
| 88 | 94 | nil |
| 89 | 95 | end |
| 90 | 96 | |
| 91 | - def push_with_commits? | |
| 97 | + def push_with_commits? | |
| 92 | 98 | md_ref? && commits.any? && parent_commit && last_commit |
| 93 | 99 | rescue Grit::NoSuchPathError |
| 94 | 100 | false | ... | ... |
app/roles/push_observer.rb
| 1 | -# Includes methods for handling Git Push events | |
| 1 | +# == PushObserver role | |
| 2 | 2 | # |
| 3 | +# Includes methods to be triggered on push to project repository. | |
| 4 | +# | |
| 5 | +# | |
| 6 | +# Used by Project | |
| 3 | 7 | # Triggered by PostReceive job |
| 8 | +# | |
| 4 | 9 | module PushObserver |
| 5 | 10 | # This method will be called after each post receive and only if the provided |
| 6 | 11 | # user is present in GitLab. | ... | ... |
app/roles/repository.rb
app/roles/team.rb
| 1 | +# == Team role | |
| 2 | +# | |
| 3 | +# Provides functionality to manage project team | |
| 4 | +# - add user/users to project | |
| 5 | +# - update existing membership | |
| 6 | +# - remove users from project team | |
| 7 | +# | |
| 8 | +# Used by Project | |
| 9 | +# | |
| 1 | 10 | module Team |
| 2 | 11 | def team_member_by_name_or_email(name = nil, email = nil) |
| 3 | 12 | user = users.where("name like ? or email like ?", name, email).first | ... | ... |