diff options
author | Nick Thomas <nick@gitlab.com> | 2017-08-28 21:33:35 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-08-30 20:50:44 +0100 |
commit | b84ca08e351fc9238bef4e6b4bf74158d25d4f1d (patch) | |
tree | e7ec9704ec449b547b6193c5e0ba771a5aae62c2 /app | |
parent | 6847060266792471c9c14518a5106e0f622cd6c5 (diff) | |
download | gitlab-ce-b84ca08e351fc9238bef4e6b4bf74158d25d4f1d.tar.gz |
Address review comments
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/form_helper.rb | 4 | ||||
-rw-r--r-- | app/models/application_setting.rb | 3 | ||||
-rw-r--r-- | app/models/key.rb | 1 | ||||
-rw-r--r-- | app/views/profiles/keys/_key_details.html.haml | 2 |
4 files changed, 4 insertions, 6 deletions
diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index 2e05b8c6d65..eeb130d5240 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -1,10 +1,10 @@ module FormHelper - def form_errors(model, headline = 'The form contains the following') + def form_errors(model, type: 'form') return unless model.errors.any? pluralized = 'error'.pluralize(model.errors.count) - headline = headline + ' ' + pluralized + ':' + headline = "The #{type} contains the following #{pluralized}:" content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do content_tag(:h4, headline) << diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 0f9053262c2..fcf31694ab5 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -442,8 +442,7 @@ class ApplicationSetting < ActiveRecord::Base def key_restriction_for(type) attr_name = "#{type}_key_restriction" - # rubocop:disable GitlabSecurity/PublicSend - has_attribute?(attr_name) ? public_send(attr_name) : FORBIDDEN_KEY_VALUE + has_attribute?(attr_name) ? public_send(attr_name) : FORBIDDEN_KEY_VALUE # rubocop:disable GitlabSecurity/PublicSend end private diff --git a/app/models/key.rb b/app/models/key.rb index 2334603b58b..a6b4dcfec0d 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -1,7 +1,6 @@ require 'digest/md5' class Key < ActiveRecord::Base - include AfterCommitQueue include Gitlab::CurrentSettings include Sortable diff --git a/app/views/profiles/keys/_key_details.html.haml b/app/views/profiles/keys/_key_details.html.haml index cf70320e7a8..77521417f47 100644 --- a/app/views/profiles/keys/_key_details.html.haml +++ b/app/views/profiles/keys/_key_details.html.haml @@ -16,7 +16,7 @@ %strong= @key.last_used_at.try(:to_s, :medium) || 'N/A' .col-md-8 - = form_errors(@key, 'The key has the following') unless @key.valid? + = form_errors(@key, type: 'key') unless @key.valid? %p %span.light Fingerprint: %code.key-fingerprint= @key.fingerprint |