diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-02-15 21:36:31 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-05 20:52:41 +0300 |
commit | 0a75de2909152351483b317024fcab2e9bb08e16 (patch) | |
tree | 3284b4be0e3121e0dc1db62e2bf85435c1d96654 /app/models/ci/trigger.rb | |
parent | c33f09d2549d2228a5ac7ceb7cb099774fbd826e (diff) |
Make Pipeline Triggers to be user aware
- they can have owner,
- they can be edited,
- they have description,
- you can take ownership of them
Diffstat (limited to 'app/models/ci/trigger.rb')
-rw-r--r-- | app/models/ci/trigger.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/ci/trigger.rb b/app/models/ci/trigger.rb index 39a1dd86241..f76f06eb9c6 100644 --- a/app/models/ci/trigger.rb +++ b/app/models/ci/trigger.rb @@ -5,10 +5,12 @@ module Ci acts_as_paranoid belongs_to :project, foreign_key: :gl_project_id + belongs_to :owner, class_name: "User" + has_many :trigger_requests, dependent: :destroy - validates :token, presence: true - validates :token, uniqueness: true + validates :token, presence: true, uniqueness: true + validates :owner, presence: true before_validation :set_default_values @@ -25,7 +27,11 @@ module Ci end def short_token - token[0...10] + token[0...4] + end + + def can_show_token?(user) + owner.blank? || owner == user end end end |