Fix edge cases in profile field UI migration (#12665)
* Fix edge cases in profile field UI migration * Fix missing statement * Fix list of attributes
This commit is contained in:
parent
ef481d07a3
commit
b61c8b7e6b
6 changed files with 33 additions and 0 deletions
3
app/assets/images/git_lab.svg
Normal file
3
app/assets/images/git_lab.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M5.868 2.75L8 10h8l2.132-7.25a.4.4 0 01.765-.01l3.495 10.924a.5.5 0 01-.173.55L12 22 1.78 14.214a.5.5 0 01-.172-.55L5.103 2.74a.4.4 0 01.765.009v.001z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 258 B |
3
app/assets/images/linked_in.svg
Normal file
3
app/assets/images/linked_in.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18.335 18.339H15.67v-4.177c0-.996-.02-2.278-1.39-2.278-1.389 0-1.601 1.084-1.601 2.205v4.25h-2.666V9.75h2.56v1.17h.035c.358-.674 1.228-1.387 2.528-1.387 2.7 0 3.2 1.778 3.2 4.091v4.715h-.001zM7.003 8.575a1.546 1.546 0 01-1.287-2.409 1.548 1.548 0 111.286 2.409h.001zm1.336 9.764H5.666V9.75H8.34v8.589h-.001zM19.67 3H4.329C3.593 3 3 3.58 3 4.297v15.406C3 20.42 3.594 21 4.328 21h15.338C20.4 21 21 20.42 21 19.703V4.297C21 3.58 20.4 3 19.666 3h.004z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 555 B |
3
app/assets/images/stack_overflow.svg
Normal file
3
app/assets/images/stack_overflow.svg
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18 20.002V14.67h2v7.333H4V14.67h2v5.333h12v-.001zM7.599 14.736l.313-1.98 8.837 1.7-.113 1.586-9.037-1.306zm1.2-4.532l.732-1.6 7.998 3.733-.733 1.599-7.998-3.732h.001zm2.265-3.932l1.133-1.333 6.798 5.665-1.133 1.333-6.798-5.665zm4.332-4.132l5.265 7.064-1.4 1.067-5.264-7.065 1.4-1.066h-.001zM7.332 18.668v-2h9.33v2h-9.33z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 429 B |
|
|
@ -31,6 +31,7 @@ class Profile < ApplicationRecord
|
|||
twitch_url
|
||||
mastodon_url
|
||||
website_url
|
||||
dribbble_url
|
||||
].freeze
|
||||
|
||||
# NOTE: @citizen428 This is a temporary mapping so we don't break DEV during
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
module DataUpdateScripts
|
||||
class FixProfileFieldEdgeCases
|
||||
def run
|
||||
ProfileField.where(attribute_name: %w[git_lab_url linked_in_url stack_overflow_url dribbble_url])
|
||||
.update_all(display_area: "settings_only")
|
||||
ProfileField.where(attribute_name: "skills_languages").update_all(display_area: "left_sidebar")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
require "rails_helper"
|
||||
require Rails.root.join(
|
||||
"lib/data_update_scripts/20210211164634_fix_profile_field_edge_cases.rb",
|
||||
)
|
||||
|
||||
describe DataUpdateScripts::FixProfileFieldEdgeCases do
|
||||
it "migrates profile fields to proper areas" do
|
||||
# Run the script
|
||||
described_class.new.run
|
||||
expect(ProfileField.find_by(attribute_name: "git_lab_url").display_area)
|
||||
.to eq("settings_only")
|
||||
expect(ProfileField.find_by(attribute_name: "skills_languages").display_area).to eq("left_sidebar")
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue