Remove looking for work columns (#12173)
* Remove looking for work columns * Fix schema.rb * Undo accidental change * Update spec
This commit is contained in:
parent
8c5b7bacb4
commit
2e202b0399
13 changed files with 46 additions and 62 deletions
|
|
@ -43,10 +43,10 @@ describe('ProfileForm', () => {
|
|||
profile_fields: [
|
||||
{
|
||||
id: 36,
|
||||
attribute_name: 'looking_for_work',
|
||||
attribute_name: 'education',
|
||||
description: '',
|
||||
input_type: 'check_box',
|
||||
label: 'Looking for work?',
|
||||
input_type: 'text_field',
|
||||
label: 'Education',
|
||||
placeholder_text: '',
|
||||
},
|
||||
],
|
||||
|
|
@ -119,7 +119,7 @@ describe('ProfileForm', () => {
|
|||
it('should render the correct group headings', async () => {
|
||||
const { findByText } = renderProfileForm();
|
||||
|
||||
const heading1 = await findByText(/Looking for work?/i);
|
||||
const heading1 = await findByText('Education');
|
||||
const heading2 = await findByText('Name');
|
||||
|
||||
expect(heading1).toBeInTheDocument();
|
||||
|
|
@ -129,7 +129,7 @@ describe('ProfileForm', () => {
|
|||
it('should render the correct fields', async () => {
|
||||
const { findByLabelText } = renderProfileForm();
|
||||
|
||||
const field1 = await findByLabelText(/Looking for work?/i);
|
||||
const field1 = await findByLabelText(/Education/i);
|
||||
const field2 = await findByLabelText(/Name/i);
|
||||
const field3 = await findByLabelText(/Website URL/i);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class Profile < ApplicationRecord
|
|||
brand_color1: :bg_color_hex,
|
||||
brand_color2: :text_color_hex,
|
||||
display_email_on_profile: :email_public,
|
||||
display_looking_for_work_on_profile: :looking_for_work_publicly,
|
||||
education: :education,
|
||||
git_lab_url: :gitlab_url,
|
||||
linked_in_url: :linkedin_url,
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ class UserPolicy < ApplicationPolicy
|
|||
instagram_url
|
||||
linkedin_url
|
||||
location
|
||||
looking_for_work
|
||||
looking_for_work_publicly
|
||||
mastodon_url
|
||||
medium_url
|
||||
mobile_comment_notifications
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ module ProfileFields
|
|||
field "Employer name", :text_field, placeholder: "Acme Inc.", display_area: "header"
|
||||
field "Employer URL", :text_field, placeholder: "https://dev.com", display_area: "settings_only"
|
||||
field "Employment title", :text_field, placeholder: "Junior Frontend Engineer", display_area: "header"
|
||||
field "Looking for work", :check_box, display_area: "settings_only"
|
||||
field 'Display "looking for work" on profile', :check_box, display_area: "settings_only"
|
||||
field "Recruiters can contact me about job opportunities", :check_box, display_area: "settings_only"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -71,16 +71,6 @@
|
|||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @user.looking_for_work_publicly == true && @user.looking_for_work == true %>
|
||||
<li>
|
||||
<div class="key">
|
||||
Work status
|
||||
</div>
|
||||
<div class="value">
|
||||
I'm looking for work!
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if @user.education.present? %>
|
||||
<li>
|
||||
<div class="key">
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
We do host first-party advertising on <%= community_name %>. We do not run any code from advertisers and all ad images are hosted on managed <%= community_name %> servers. For more details, see our section on Advertising Details.
|
||||
<br>
|
||||
<br>
|
||||
We may use User Personal Information with your permission, so we can perform services you have authorized. For example, if you indicate you are looking for work, we may contact you with opportunities.
|
||||
We may use User Personal Information with your permission, so we can perform services you have authorized.
|
||||
<br>
|
||||
<br>
|
||||
We may share User Personal Information with a limited number of third party vendors who process it on our behalf to provide or improve our service, and who have agreed to privacy restrictions similar to our own Privacy Statement. Our third party vendors are listed below.
|
||||
|
|
|
|||
|
|
@ -13,35 +13,27 @@
|
|||
<% end %>
|
||||
<%# As we migrate to more generalized profiles, we don't want to break DEV %>
|
||||
<% if SiteConfig.dev_to? %>
|
||||
<% if @user.employment_title.present? || (@user.looking_for_work_publicly == true && @user.looking_for_work == true) %>
|
||||
<% if @user.employment_title.present? %>
|
||||
<div class="crayons-definition">
|
||||
<strong class="crayons-definition__title">Work</strong>
|
||||
<p class="crayons-definition__value">
|
||||
<%= @user.employment_title %>
|
||||
<% if @user.employer_name.present? %>
|
||||
<span class="opacity-50"> at </span>
|
||||
<% if @user.employer_url.present? %>
|
||||
<a href="<%= @user.employer_url %>" class="crayons-link crayons-link--brand" target="_blank" rel="noopener"><%= @user.employer_name %></a>
|
||||
<% else %>
|
||||
<%= @user.employer_name %>
|
||||
<% end %>
|
||||
<% if @user.employment_title.present? %>
|
||||
<div class="crayons-definition">
|
||||
<strong class="crayons-definition__title">Work</strong>
|
||||
<p class="crayons-definition__value">
|
||||
<%= @user.employment_title %>
|
||||
<% if @user.employer_name.present? %>
|
||||
<span class="opacity-50"> at </span>
|
||||
<% if @user.employer_url.present? %>
|
||||
<a href="<%= @user.employer_url %>" class="crayons-link crayons-link--brand" target="_blank" rel="noopener"><%= @user.employer_name %></a>
|
||||
<% else %>
|
||||
<%= @user.employer_name %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @user.looking_for_work_publicly == true && @user.looking_for_work == true %>
|
||||
<div class="crayons-definition">
|
||||
<strong class="crayons-definition__title">Work status</strong>
|
||||
<p class="crayons-definition__value">I'm looking for work!</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @user.employment_title.present? || (@user.looking_for_work_publicly == true && @user.looking_for_work == true) || @user.education.present? %>
|
||||
<% if @user.employment_title.present? || @user.education.present? %>
|
||||
<div class="profile-header__bottom fs-base">
|
||||
<% if @user.education.present? %>
|
||||
<div class="crayons-definition">
|
||||
|
|
@ -66,13 +58,6 @@
|
|||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if @user.looking_for_work_publicly == true && @user.looking_for_work == true %>
|
||||
<div class="crayons-definition">
|
||||
<strong class="crayons-definition__title">Work status</strong>
|
||||
<p class="crayons-definition__value">I'm looking for work!</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
class RemoveLookingForWorkFromUsers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
safety_assured do
|
||||
remove_column :users, :looking_for_work
|
||||
remove_column :users, :looking_for_work_publicly
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_01_05_183127) do
|
||||
ActiveRecord::Schema.define(version: 2021_01_08_031718) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "citext"
|
||||
|
|
@ -1283,8 +1283,6 @@ ActiveRecord::Schema.define(version: 2021_01_05_183127) do
|
|||
t.string "linkedin_url"
|
||||
t.string "location"
|
||||
t.datetime "locked_at"
|
||||
t.boolean "looking_for_work", default: false
|
||||
t.boolean "looking_for_work_publicly", default: false
|
||||
t.string "mastodon_url"
|
||||
t.string "medium_url"
|
||||
t.boolean "mobile_comment_notifications", default: true
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ Education,text_field,,,Work,header,false
|
|||
Employer name,text_field,Acme Inc.,,Work,header,false
|
||||
Employer URL,text_field,https://dev.com,,Work,header,false
|
||||
Employment title,text_field,Junior Frontend Engineer,,Work,header,false
|
||||
Looking for work,check_box,,,Work,settings_only,false
|
||||
"Display ""looking for work"" on profile",check_box,,,Work,settings_only,false
|
||||
Recruiters can contact me about job opportunities,check_box,,,Work,settings_only,false
|
||||
Skills/Languages,text_area,,What tools and languages are you most experienced with? Are you specialized or more of a generalist?,Coding,left_sidebar,false
|
||||
Currently learning,text_area,,"What are you learning right now? What are the new tools and languages you're picking up right now?",Coding,left_sidebar,false
|
||||
|
|
|
|||
|
|
|
@ -0,0 +1,10 @@
|
|||
module DataUpdateScripts
|
||||
class RemoveLookingForWorkProfileFields
|
||||
def run
|
||||
# destroy_by is idempotent by default: if no record can be found an empty
|
||||
# array will be returned.
|
||||
ProfileField.destroy_by(attribute_name: "looking_for_work")
|
||||
ProfileField.destroy_by(attribute_name: "display_looking_for_work_on_profile")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -15,7 +15,7 @@ describe DataUpdateScripts::CreateProfileFields do
|
|||
it "creates all profile fields and groups" do
|
||||
expect do
|
||||
described_class.new.run
|
||||
end.to change { profile_field_and_group_count }.from([0, 0]).to([28, 5])
|
||||
end.to change { profile_field_and_group_count }.from([0, 0]).to([26, 5])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ describe DataUpdateScripts::CreateProfileFields do
|
|||
expect do
|
||||
described_class.new.run
|
||||
end.not_to change { profile_field_and_group_count }
|
||||
expect(profile_field_and_group_count).to eq [28, 5]
|
||||
expect(profile_field_and_group_count).to eq [26, 5]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ RSpec.describe Profiles::Update, type: :service do
|
|||
end
|
||||
|
||||
let(:profile) do
|
||||
create(:profile, data: { looking_for_work: true, removed: "Bla" })
|
||||
create(:profile, data: { education: "maybe", removed: "Bla" })
|
||||
end
|
||||
let(:user) { profile.user }
|
||||
|
||||
it "correctly typecasts new attributes", :aggregate_failures do
|
||||
described_class.call(user, profile: { location: 123, looking_for_work: "false" })
|
||||
described_class.call(user, profile: { location: 123, education: "false" })
|
||||
expect(user.location).to eq "123"
|
||||
expect(profile.looking_for_work).to be false
|
||||
expect(profile.education).to eq "false"
|
||||
end
|
||||
|
||||
it "removes old attributes from the profile" do
|
||||
|
|
@ -43,7 +43,7 @@ RSpec.describe Profiles::Update, type: :service do
|
|||
|
||||
it "updates the profile_updated_at column" do
|
||||
expect do
|
||||
described_class.call(user, profile: { looking_for_work: "false" })
|
||||
described_class.call(user, profile: { education: "false" })
|
||||
end.to change { user.reload.profile_updated_at }
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue