Commit adafbefe authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'remove-org-readonly' into 'master'

Remove override of Organization for GitLab Team Members

See merge request gitlab-org/gitlab!32262
parents b1f50a52 f299c16d
......@@ -104,7 +104,7 @@
- else
= f.text_field :location, label: s_('Profiles|Location'), class: 'input-lg', placeholder: s_("Profiles|City, country")
= f.text_field :job_title, class: 'input-md'
= render 'shared/profiles/organization', { form: f, user: @user }
= f.text_field :organization, label: s_('Profiles|Organization'), class: 'input-md', help: s_("Profiles|Who you represent or work for")
= f.text_area :bio, label: s_('Profiles|Bio'), rows: 4, maxlength: 250, help: s_("Profiles|Tell us about yourself in fewer than 250 characters")
%hr
%h5= s_("Private profile")
......
= form.text_field :organization, label: s_('Profiles|Organization'), class: 'input-md', help: s_("Profiles|Who you represent or work for")
......@@ -355,10 +355,6 @@ module EE
end
end
def organization
gitlab_employee? ? 'GitLab' : super
end
def security_dashboard
InstanceSecurityDashboard.new(self)
end
......
= form.text_field :organization, readonly: user.gitlab_employee?, label: s_('Profiles|Organization'), class: 'input-md', help: s_("Profiles|Who you represent or work for")
......@@ -1174,27 +1174,6 @@ describe User do
end
end
describe '#organization' do
using RSpec::Parameterized::TableSyntax
let(:user) { build(:user, organization: 'ACME') }
subject { user.organization }
where(:gitlab_employee?, :expected_result) do
true | 'GitLab'
false | 'ACME'
end
with_them do
before do
allow(user).to receive(:gitlab_employee?).and_return(gitlab_employee?)
end
it { is_expected.to eql(expected_result) }
end
end
describe '#security_dashboard' do
let(:user) { create(:user) }
......
# frozen_string_literal: true
require 'spec_helper'
describe 'profiles/show' do
context 'gitlab.com organization field' do
let(:user) { create(:user) }
before do
assign(:user, user)
allow(controller).to receive(:current_user).and_return(user)
allow(view).to receive(:experiment_enabled?)
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when `:gitlab_employee_badge` feature flag is enabled' do
context 'and when user is a gitlab team member' do
include_context 'gitlab team member'
it 'displays the organization field as `readonly` with a `value` of `GitLab`' do
render
expect(rendered).to have_selector('#user_organization[readonly][value="GitLab"]')
end
end
context 'and when a user is not a gitlab team member' do
it 'displays an editable organization field' do
render
expect(rendered).to have_selector('#user_organization:not([readonly]):not([value="GitLab"])')
end
end
end
context 'when `:gitlab_employee_badge` feature flag is disabled' do
before do
stub_feature_flags(gitlab_employee_badge: false)
end
context 'and when a user is a gitlab team member' do
include_context 'gitlab team member'
it 'displays an editable organization field' do
render
expect(rendered).to have_selector('#user_organization:not([readonly]):not([value="GitLab"])')
end
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