summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-09-16 09:04:29 +0000
committerRémy Coutable <remy@rymai.me>2016-09-16 09:04:29 +0000
commit6c168d408a55321b2c8b5103854fc305eab34db9 (patch)
treeb71a6bd678c5451a7e91402c436eabb54611bb4a /app
parent55246824285984bf41d123f4e7aefa432a37b76d (diff)
parent43d2cd511c3e068f78fb71387ae0ac31db4926b1 (diff)
downloadgitlab-ce-6c168d408a55321b2c8b5103854fc305eab34db9.tar.gz
Merge branch '20870-secret-variables-sorted-by-key' into 'master'
Sort secret keys by key instead of id. Closes #20870 See merge request !6275
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/variable.rb6
-rw-r--r--app/views/projects/variables/_table.html.haml2
2 files changed, 5 insertions, 3 deletions
diff --git a/app/models/ci/variable.rb b/app/models/ci/variable.rb
index c9c47ec7419..6959223aed9 100644
--- a/app/models/ci/variable.rb
+++ b/app/models/ci/variable.rb
@@ -1,7 +1,7 @@
module Ci
class Variable < ActiveRecord::Base
extend Ci::Model
-
+
belongs_to :project, class_name: '::Project', foreign_key: :gl_project_id
validates_uniqueness_of :key, scope: :gl_project_id
@@ -11,7 +11,9 @@ module Ci
format: { with: /\A[a-zA-Z0-9_]+\z/,
message: "can contain only letters, digits and '_'." }
- attr_encrypted :value,
+ scope :order_key_asc, -> { reorder(key: :asc) }
+
+ attr_encrypted :value,
mode: :per_attribute_iv_and_salt,
insecure_mode: true,
key: Gitlab::Application.secrets.db_key_base,
diff --git a/app/views/projects/variables/_table.html.haml b/app/views/projects/variables/_table.html.haml
index 6c43f822db4..07cee86ba4c 100644
--- a/app/views/projects/variables/_table.html.haml
+++ b/app/views/projects/variables/_table.html.haml
@@ -9,7 +9,7 @@
%th Value
%th
%tbody
- - @project.variables.each do |variable|
+ - @project.variables.order_key_asc.each do |variable|
- if variable.id?
%tr
%td= variable.key