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
end
end
end
def show_user_status_field?
Feature.enabled?(:user_status_form) || cookies[:feature_user_status_form] == 'true'
end
end
......@@ -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
......
---
title: Users can set a status message and emoji
merge_request: 20614
author:
author: niedermyer & davamr
type: added
......@@ -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
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