Skip to content

Commit 42dff9e

Browse files
committed
fix: use maybe_link for top contributions to respect anonymized state
- Replace .link with .maybe_link in top contributions sections - Add class attribute support to maybe_link component - For anonymized matches, href is set to nil to prevent user exposure - Applicants (developer_card) keep links since they've explicitly applied
1 parent 73e01b5 commit 42dff9e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/algora_web/components/core_components.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,7 @@ defmodule AlgoraWeb.CoreComponents do
12901290
attr :replace, :boolean, default: false
12911291
attr :target, :string, default: nil
12921292
attr :rel, :string, default: nil
1293+
attr :class, :string, default: nil
12931294
slot :inner_block
12941295

12951296
def maybe_link(assigns) do
@@ -1302,11 +1303,12 @@ defmodule AlgoraWeb.CoreComponents do
13021303
replace={@replace}
13031304
target={@target}
13041305
rel={@rel}
1306+
class={@class}
13051307
>
13061308
{render_slot(@inner_block)}
13071309
</.link>
13081310
<% else %>
1309-
<span>{render_slot(@inner_block)}</span>
1311+
<span class={@class}>{render_slot(@inner_block)}</span>
13101312
<% end %>
13111313
"""
13121314
end

lib/algora_web/live/org/job_live.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ defmodule AlgoraWeb.Org.JobLive do
796796
<% end %>
797797
<% else %>
798798
<%= for {owner, contributions} <- aggregate_contributions(@contributions) |> Enum.take(3) do %>
799-
<.link
799+
<.maybe_link
800800
href={"https://github.com/#{owner.provider_login}/#{List.first(contributions).repository.name}/pulls?q=author%3A#{@application.user.provider_login}+is%3Amerged+"}
801801
target="_blank"
802802
rel="noopener"
@@ -842,7 +842,7 @@ defmodule AlgoraWeb.Org.JobLive do
842842
</span>
843843
</div>
844844
</div>
845-
</.link>
845+
</.maybe_link>
846846
<% end %>
847847
<% end %>
848848
</div>
@@ -960,8 +960,8 @@ defmodule AlgoraWeb.Org.JobLive do
960960
</p>
961961
<div class="flex flex-col gap-3 mt-2">
962962
<%= for {owner, contributions} <- aggregate_contributions(@contributions) |> Enum.take(3) do %>
963-
<.link
964-
href={"https://github.com/#{owner.provider_login}/#{List.first(contributions).repository.name}/pulls?q=author%3A#{@user.provider_login}+is%3Amerged+"}
963+
<.maybe_link
964+
href={if @anonymized, do: nil, else: "https://github.com/#{owner.provider_login}/#{List.first(contributions).repository.name}/pulls?q=author%3A#{@user.provider_login}+is%3Amerged+"}
965965
target="_blank"
966966
rel="noopener"
967967
class="flex items-center gap-3 rounded-xl pr-2 bg-card/50 border border-border/50 hover:border-border transition-all"
@@ -1001,7 +1001,7 @@ defmodule AlgoraWeb.Org.JobLive do
10011001
</span>
10021002
</div>
10031003
</div>
1004-
</.link>
1004+
</.maybe_link>
10051005
<% end %>
10061006
</div>
10071007
</div>

0 commit comments

Comments
 (0)