Commit 92524140 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Hide the status fields behind a feature flag

Since the frontend for this feature isn't ready, better to hide the
confusing field behind a feature flag.
parent f1d3ea63
...@@ -9,4 +9,8 @@ module ProfilesHelper ...@@ -9,4 +9,8 @@ module ProfilesHelper
end end
end end
end end
def show_user_status_field?
Feature.enabled?(:user_status_form) || cookies[:feature_user_status_form] == 'true'
end
end end
...@@ -30,16 +30,18 @@ ...@@ -30,16 +30,18 @@
- if @user.avatar? - if @user.avatar?
%hr %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' = 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 - if show_user_status_field?
.col-lg-4.profile-settings-sidebar %hr
%h4.prepend-top-0= s_("User|Current Status") .row
%p= _("This emoji and message will appear on your profile and throughout the interface.") .col-lg-4.profile-settings-sidebar
.col-lg-8 %h4.prepend-top-0= s_("User|Current Status")
.row %p= _("This emoji and message will appear on your profile and throughout the interface.")
= f.fields_for :status, @user.status do |status_form| .col-lg-8
= status_form.text_field :emoji .row
= status_form.text_field :message, maxlength: 100 = f.fields_for :status, @user.status do |status_form|
= status_form.text_field :emoji
= status_form.text_field :message, maxlength: 100
%hr %hr
.row .row
.col-lg-4.profile-settings-sidebar .col-lg-4.profile-settings-sidebar
......
--- ---
title: Users can set a status message and emoji title: Users can set a status message and emoji
merge_request: 20614 merge_request: 20614
author: author: niedermyer & davamr
type: added type: added
...@@ -55,4 +55,31 @@ describe 'User edit profile' do ...@@ -55,4 +55,31 @@ describe 'User edit profile' do
expect(page).to have_link('gravatar.com') expect(page).to have_link('gravatar.com')
end end
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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment