Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/assets/images/bluesky.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/avo/resources/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def fields
field :github_url, as: :text
field :linkedin_url, as: :text
field :twitter_url, as: :text
field :bsky_url, as: :text
field :is_public, as: :boolean, default: true
end
end
2 changes: 1 addition & 1 deletion app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def set_profile
def profile_params
params.require(:profile).permit(
:name, :job_title, :bio, :is_public, :image,
:twitter_url, :linkedin_url, :github_url,
:twitter_url, :linkedin_url, :github_url, :bluesky_url,
:web_push_notifications, :mail_notifications
)
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Profile < ApplicationRecord
validates :github_url, url: {allow_blank: true, schemes: ["https"]}
validates :linkedin_url, url: {allow_blank: true, schemes: ["https"]}
validates :twitter_url, url: {allow_blank: true, schemes: ["https"]}
validates :bluesky_url, url: {allow_blank: true, schemes: ["https"]}

before_validation :set_uuid
before_validation :set_url_scheme
Expand All @@ -47,7 +48,7 @@ def set_uuid
end

def set_url_scheme
%i[github_url linkedin_url twitter_url].each do |url|
%i[github_url linkedin_url twitter_url bluesky_url].each do |url|
next if send(url).blank?

uri_parse = URI.parse(send(url))
Expand Down
17 changes: 2 additions & 15 deletions app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
<%= title "Edit profile" %>

<% content_for :top_nav do %>
<%= render partial: "layouts/primary_top_nav" %>
<% end %>

<%= content_for(:head) do %>
<%# Disabling morphing so that when an error occurs, the user is "redirected" to the top of the page %>
<meta name="turbo-refresh-method" content="replace">
<meta name="turbo-refresh-scroll" content="reset">
<% end %>

<div class="flex flex-col items-center justify-center w-full bg-purple-dark dark:bg-[#0f171b] pt-safe-area-header pb-safe-area-bottom-navbar">
<div class="flex flex-col w-full p-4 max-w-screen-sm">
<h1 class="w-full mb-6 text-3xl font-black text-white dark:text-lightcolor">Set up your account</h1>

<%= form_with model: @profile, url: profile_path(@profile.uuid), class: "flex flex-col items-center" do |form| %>
<div class="relative" data-controller="image-previewer">
<%= form.label(
Expand Down Expand Up @@ -51,32 +47,26 @@
</div>
<div class="flex flex-col items-start w-full">
<%= render partial: "shared/form_errors", locals: { errors: form.object.errors.full_messages } %>

<%= form.label :name, class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_field :name, class: "w-full mb-6", placeholder: "John P. Doe" %>

<%= form.label :bio, class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_area :bio, class: "w-full mb-6", placeholder: "I'm a Ruby on Rails developer with six years of experience. Outside of work, I enjoy hiking and using dating apps.", rows: 3 %>

<%= form.label :job_title, class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_field :job_title, class: "w-full mb-6", placeholder: "Senior Developer at Telos Labs" %>

<%= form.label :github_url, "GitHub", class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_field :github_url, class: "w-full mb-6", placeholder: "https://github.com/johnp" %>

<%= form.label :linkedin_url, "LinkedIn", class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_field :linkedin_url, class: "w-full mb-6", placeholder: "https://www.linkedin.com/in/johnp" %>

<%= form.label :twitter_url, "X (formerly Twitter)", class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_field :twitter_url, class: "w-full mb-6", placeholder: "https://x.com/johnp" %>

<%= form.label :bluesky_url, "Bluesky", class: "font-bold text-white text-base mb-2 dark:text-lightcolor" %>
<%= form.text_field :bluesky_url, class: "w-full mb-6", placeholder: "https://bsky.app/profile/johnp.bsky.social" %>
<p class="mb-2 font-bold text-white dark:text-lightcolor">Discoverability</p>
<div class="flex flex-row items-center justify-between w-full p-4 bg-white dark:bg-[#182027] rounded-md">
<%= form.label :is_public, "Public profile", class: "grow font-medium text-slate-900 dark:text-lightcolor text-base cursor-pointer mr-2" %>
<%= form.toggle_field :is_public %>
</div>
<p class="mt-1 mb-6 text-xs text-white">Allow other persons to view your profile through a QR code.</p>

<p class="mb-2 font-bold text-white dark:text-lightcolor">Notifications</p>
<div class="w-full mb-10">
<div class="w-full overflow-hidden rounded-md">
Expand All @@ -98,7 +88,6 @@
</p>
</div>
</div>

<%= form.submit(
"SAVE PROFILE",
class: [
Expand All @@ -107,7 +96,6 @@
],
data: { test_id: "save_profile_button" }
) %>

<% if params[:onboarding].present? %>
<%= link_to(
"Skip for now", root_path,
Expand All @@ -122,7 +110,6 @@
<% end %>
</div>
</div>

<% content_for :bottom_nav do %>
<%= render partial: "layouts/bottom_navbar", locals: { unread_notifications: current_user&.notifications&.unread } %>
<% end %>
19 changes: 11 additions & 8 deletions app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<%= title "Profile" %>

<% content_for :top_nav do %>
<%= render partial: "layouts/primary_top_nav" %>
<% end %>

<div class="relative flex flex-col items-center justify-between flex-1 h-full bg-grey-50 dark:bg-[#0f171b] pt-safe-area-header pb-safe-area-bottom-navbar">
<div class="flex flex-col items-center w-full h-full bg-bottom bg-no-repeat bg-cover">
<div class="z-10 flex flex-col items-start w-full px-5 pt-6 pb-12 max-w-screen-sm">
Expand Down Expand Up @@ -57,23 +55,30 @@
<img src="<%= asset_path 'linkedin.svg' %>" alt="linkedin" class="w-6 h-6">
<% end %>
<% end %>
<% if @profile.bluesky_url.present? %>
<%= link_to(
@profile.bluesky_url,
target: "_blank",
class: "flex flex-row grow items-center justify-center w-28 h-14 rounded-lg mt-6 bg-red dark:bg-[#182027]",
data: { test_id: "bluesky_link" }
) do %>
<img src="<%= asset_path 'bluesky.svg' %>" alt="bluesky" class="w-6 h-6">
<% end %>
<% end %>
</div>
</div>
</div>

<% if allowed_to?(:edit?, @profile, with: ProfilePolicy) %>
<div class="flex flex-col items-center w-full p-4 gap-6">
<% if @profile.is_public? %>
<div class="p-6 bg-white rounded-2xl">
<%= render inline: @profile.svg_qr_code(module_size: 4, svg_attributes: { "data-test-id": "qr_code" }) %>
</div>
<% end %>

<%= link_to(
'Edit Profile', edit_profile_path(@profile.uuid),
class: "text-red dark:text-dark-theme-red font-bold rounded-sm underline italic text-lg"
) %>

<div data-controller="dark-mode" class="w-full px-4 pb-8 max-w-screen-sm">
<label for="theme-select" class="block mb-2 font-black italic uppercase text-red dark:text-[#798691]">
Theme
Expand All @@ -84,7 +89,6 @@
<option value="system">System</option>
</select>
</div>

<%= button_to(
"Log out", user_session_path, method: :delete,
form_class: "w-full max-w-screen-sm px-4",
Expand All @@ -100,7 +104,7 @@
}
) %>
</div>
<% else %>
<% else %>
<div class="">
<%= button_to "Report Abuse", abuse_reports_path(uuid: @profile.uuid),
method: :post,
Expand All @@ -112,7 +116,6 @@
</div>
<% end %>
</div>

<% content_for :bottom_nav do %>
<%= render partial: "layouts/bottom_navbar", locals: { unread_notifications: current_user&.notifications&.unread } %>
<% end %>
5 changes: 5 additions & 0 deletions db/migrate/20250823000001_add_bluesky_url_to_profiles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddBlueskyUrlToProfiles < ActiveRecord::Migration[8.0]
def change
add_column :profiles, :bluesky_url, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions spec/factories/profiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
github_url { "https://github.com" }
linkedin_url { "https://linkedin.com" }
twitter_url { "https://twitter.com" }
bluesky_url { "https://bsky.app" }
uuid { SecureRandom.uuid }

trait :with_user do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

describe "validations" do
it "validates socials urls" do
%i[github_url linkedin_url twitter_url].each do |url|
%i[github_url linkedin_url twitter_url bluesky_url].each do |url|
profile[url] = "http://foo bar.com"
expect(profile).not_to be_valid

Expand Down
3 changes: 3 additions & 0 deletions spec/system/profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
expect(page).to have_no_css(dti("github_link"))
expect(page).to have_no_css(dti("twitter_link"))
expect(page).to have_no_css(dti("linkedin_link"))
expect(page).to have_no_css(dti("bluesky_link"))

visit edit_profile_path(profile.uuid)

Expand All @@ -23,6 +24,7 @@
find_by_id("profile_github_url").set("github.com/johndoe")
find_by_id("profile_linkedin_url").set("linkedin.com/johndoe")
find_by_id("profile_twitter_url").set("twitter.com/johndoe")
find_by_id("profile_bluesky_url").set("bsky.app/johndoe")
find('[for="profile_is_public"]').click

find_dti("save_profile_button").click
Expand All @@ -32,6 +34,7 @@
expect(page).to have_css(dti("github_link"))
expect(page).to have_css(dti("twitter_link"))
expect(page).to have_css(dti("linkedin_link"))
expect(page).to have_css(dti("bluesky_link"))
expect(find_dti("qr_code")).to be_present
end
end
Expand Down