Do not show danger zone when group is synced

This commit is contained in:
Andrew Dryga
2023-12-07 22:48:55 -05:00
parent 0eee8a7c26
commit 3280827a18
2 changed files with 5 additions and 3 deletions

View File

@@ -101,7 +101,7 @@ defmodule Web.Groups.Show do
</:content>
</.section>
<.danger_zone :if={is_nil(@group.deleted_at)}>
<.danger_zone :if={is_nil(@group.deleted_at) and not Actors.group_synced?(@group)}>
<:action>
<.delete_button
phx-click="delete"

View File

@@ -202,7 +202,7 @@ defmodule Web.Live.Groups.ShowTest do
{:error, {:live_redirect, %{to: ~p"/#{account}/groups/#{group}/edit", kind: :push}}}
end
test "does not allow editing synced groups", %{
test "does not allow editing or deleting synced groups", %{
account: account,
group: group,
identity: identity,
@@ -219,12 +219,14 @@ defmodule Web.Live.Groups.ShowTest do
)
|> Repo.update!()
{:ok, lv, _html} =
{:ok, lv, html} =
conn
|> authorize_conn(identity)
|> live(~p"/#{account}/groups/#{group}")
refute has_element?(lv, "a", "Edit Group")
refute has_element?(lv, "a", "Delete Group")
refute html =~ "Danger Zone"
end
test "allows editing actors", %{