summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-12-04 10:17:21 +0000
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-12-04 15:14:34 +0000
commit84352177d454e1a8dfa952efca65558501bd9c7d (patch)
tree7813f8aae0ef1a3f83fd345b9f8bc4acc4b30fe4
parent5978b98c5f50bf0a2f9ffb14d950d9a93b14ca4b (diff)
downloadgitlab-ce-84352177d454e1a8dfa952efca65558501bd9c7d.tar.gz
Replace @user with current_user on Account page
Previously we used @user, but this changed to local_assigns[:user] so we could pass a second variable to the view from an EE module Since we were already using current_user librally there it makes sense to replace the remaining usages. See: https://docs.gitlab.com/ee/development/module_with_instance_variables.html
-rw-r--r--app/controllers/profiles/accounts_controller.rb2
-rw-r--r--app/views/profiles/accounts/show.html.haml7
2 files changed, 4 insertions, 5 deletions
diff --git a/app/controllers/profiles/accounts_controller.rb b/app/controllers/profiles/accounts_controller.rb
index 13660e27a27..b0d65f284af 100644
--- a/app/controllers/profiles/accounts_controller.rb
+++ b/app/controllers/profiles/accounts_controller.rb
@@ -27,6 +27,6 @@ class Profiles::AccountsController < Profiles::ApplicationController
private
def show_view_variables
- { user: current_user }
+ {}
end
end
diff --git a/app/views/profiles/accounts/show.html.haml b/app/views/profiles/accounts/show.html.haml
index fffdc305623..e167e094240 100644
--- a/app/views/profiles/accounts/show.html.haml
+++ b/app/views/profiles/accounts/show.html.haml
@@ -1,6 +1,5 @@
- page_title "Account"
- @content_class = "limit-container-width" unless fluid_layout
-- user = local_assigns.fetch(:user)
- if current_user.ldap_user?
.alert.alert-info
@@ -68,7 +67,7 @@
%h4.prepend-top-0.danger-title
= s_('Profiles|Delete account')
.col-lg-8
- - if user.can_be_removed? && can?(current_user, :destroy_user, user)
+ - if current_user.can_be_removed? && can?(current_user, :destroy_user, current_user)
%p
= s_('Profiles|Deleting an account has the following effects:')
= render 'users/deletion_guidance', user: current_user
@@ -81,10 +80,10 @@
confirm_with_password: ('true' if current_user.confirm_deletion_with_password?),
username: current_user.username } }
- else
- - if user.solo_owned_groups.present?
+ - if current_user.solo_owned_groups.present?
%p
= s_('Profiles|Your account is currently an owner in these groups:')
- %strong= user.solo_owned_groups.map(&:name).join(', ')
+ %strong= current_user.solo_owned_groups.map(&:name).join(', ')
%p
= s_('Profiles|You must transfer ownership or delete these groups before you can delete your account.')
- else