summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-07-24 16:16:09 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-07-25 15:15:34 +0200
commitcf076642f0f2b9c506e80da723f78b79b98dafd6 (patch)
treea88ec0190a80bdd3d01ce1c2f69b42be5fa5aeac
parent1f647febe564281699884431e6263afc74786ebb (diff)
downloadgitlab-ce-bvl-user-status-message-35463.tar.gz
Hide the status fields behind a feature flagbvl-user-status-message-35463
Since the frontend for this feature isn't ready, better to hide the confusing field behind a feature flag.
-rw-r--r--app/helpers/profiles_helper.rb4
-rw-r--r--app/views/profiles/show.html.haml22
-rw-r--r--changelogs/unreleased/bvl-user-status-message-35463.yml2
-rw-r--r--spec/features/profiles/user_edit_profile_spec.rb27
4 files changed, 44 insertions, 11 deletions
diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb
index e7aa92e6e5c..a6a57db3002 100644
--- a/app/helpers/profiles_helper.rb
+++ b/app/helpers/profiles_helper.rb
@@ -9,4 +9,8 @@ module ProfilesHelper
end
end
end
+
+ def show_user_status_field?
+ Feature.enabled?(:user_status_form) || cookies[:feature_user_status_form] == 'true'
+ end
end
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 5e70cc09104..73099297a38 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -30,16 +30,18 @@
- if @user.avatar?
%hr
= link_to _('Remove avatar'), profile_avatar_path, data: { confirm: _('Avatar will be removed. Are you sure?') }, method: :delete, class: 'btn btn-danger btn-inverted'
- %hr
- .row
- .col-lg-4.profile-settings-sidebar
- %h4.prepend-top-0= s_("User|Current Status")
- %p= _("This emoji and message will appear on your profile and throughout the interface.")
- .col-lg-8
- .row
- = f.fields_for :status, @user.status do |status_form|
- = status_form.text_field :emoji
- = status_form.text_field :message, maxlength: 100
+
+ - if show_user_status_field?
+ %hr
+ .row
+ .col-lg-4.profile-settings-sidebar
+ %h4.prepend-top-0= s_("User|Current Status")
+ %p= _("This emoji and message will appear on your profile and throughout the interface.")
+ .col-lg-8
+ .row
+ = f.fields_for :status, @user.status do |status_form|
+ = status_form.text_field :emoji
+ = status_form.text_field :message, maxlength: 100
%hr
.row
.col-lg-4.profile-settings-sidebar
diff --git a/changelogs/unreleased/bvl-user-status-message-35463.yml b/changelogs/unreleased/bvl-user-status-message-35463.yml
index 981f0608c29..c844e7ea0e4 100644
--- a/changelogs/unreleased/bvl-user-status-message-35463.yml
+++ b/changelogs/unreleased/bvl-user-status-message-35463.yml
@@ -1,5 +1,5 @@
---
title: Users can set a status message and emoji
merge_request: 20614
-author:
+author: niedermyer & davamr
type: added
diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb
index 0b5eacbe916..96bbe6f93f1 100644
--- a/spec/features/profiles/user_edit_profile_spec.rb
+++ b/spec/features/profiles/user_edit_profile_spec.rb
@@ -55,4 +55,31 @@ describe 'User edit profile' do
expect(page).to have_link('gravatar.com')
end
end
+
+ context 'user status' do
+ it 'hides user status when the feature is disabled' do
+ stub_feature_flags(user_status_form: false)
+
+ visit(profile_path)
+
+ expect(page).not_to have_content('Current Status')
+ end
+
+ it 'shows the status form when the feature is enabled' do
+ stub_feature_flags(user_status_form: true)
+
+ visit(profile_path)
+
+ expect(page).to have_content('Current Status')
+ end
+
+ it 'shows the status form when the feature is enabled by setting a cookie', :js do
+ stub_feature_flags(user_status_form: false)
+ set_cookie('feature_user_status_form', 'true')
+
+ visit(profile_path)
+
+ expect(page).to have_content('Current Status')
+ end
+ end
end