Skip to content
Open
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
16 changes: 15 additions & 1 deletion lib/algora_web/live/org/bounties_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ defmodule AlgoraWeb.Org.BountiesLive do
<% end %>
</td>
<td class="[&:has([role=checkbox])]:pr-0 p-4 align-middle">
<div class="flex items-center justify-end gap-2">
<div :if={can_manage_bounties?(assigns)} class="flex items-center justify-end gap-2">
<.button
phx-click="edit-bounty-amount"
phx-value-id={bounty.id}
Expand Down Expand Up @@ -618,6 +618,20 @@ defmodule AlgoraWeb.Org.BountiesLive do
end)
end

defp can_manage_bounties?(assigns) do
user = assigns[:current_user]
org = assigns[:current_org]

if user && org do
case Algora.Organizations.fetch_member(org.id, user.id) do
{:ok, member} -> member.role in [:admin, :mod]
_ -> false
end
else
false
end
end

defp to_transaction_rows(transactions), do: transactions

defp assign_more_bounties(socket) do
Expand Down