BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
0a75de29
Unverified
Commit
0a75de29
authored
Feb 15, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain 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
parent
c33f09d2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
trigger.rb
app/models/ci/trigger.rb
+9
-3
20170215164610_add_owner_id_to_triggers.rb
db/migrate/20170215164610_add_owner_id_to_triggers.rb
+10
-0
20170215165036_add_description_to_triggers.rb
db/migrate/20170215165036_add_description_to_triggers.rb
+9
-0
No files found.
app/models/ci/trigger.rb
View file @
0a75de29
...
...
@@ -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
db/migrate/20170215164610_add_owner_id_to_triggers.rb
0 → 100644
View file @
0a75de29
class
AddOwnerIdToTriggers
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:ci_triggers
,
:owner_id
,
:integer
add_foreign_key
:ci_triggers
,
:users
,
column: :owner_id
,
on_delete: :nullify
end
end
db/migrate/20170215165036_add_description_to_triggers.rb
0 → 100644
View file @
0a75de29
class
AddDescriptionToTriggers
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
def
change
add_column
:ci_triggers
,
:description
,
:string
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment