Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(portal): don't confirm group selections if there aren't changes #4946

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 14 additions & 4 deletions elixir/apps/web/lib/web/live/actors/groups.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,14 @@ defmodule Web.Actors.EditGroups do
</div>
</:col>
</.live_table>
<.button class="m-4" data-confirm={confirm_message(@added, @removed)} phx-click="submit">
Save
</.button>
<div class="flex justify-between items-center">
<p class="px-4 text-sm text-gray-500">
Note: Users will always belong to the <strong>Everyone</strong> group.
</p>
<.button class="m-4" data-confirm={confirm_message(@added, @removed)} phx-click="submit">
Save
</.button>
</div>
</div>
</:content>
</.section>
Expand Down Expand Up @@ -218,7 +223,12 @@ defmodule Web.Actors.EditGroups do
remove = if removed_names != [], do: "remove #{Enum.join(removed_names, ", ")}"
change = [add, remove] |> Enum.reject(&is_nil/1) |> Enum.join(" and ")

"Are you sure you want to #{change}?"
if change == "" do
# Don't show confirmation message if no changes were made
nil
else
"Are you sure you want to #{change}?"
end
end

defp remove_non_editable_memberships(memberships, editable_groups) do
Expand Down
7 changes: 6 additions & 1 deletion elixir/apps/web/lib/web/live/groups/edit_actors.ex
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ defmodule Web.Groups.EditActors do
remove = if removed_names != [], do: "remove #{Enum.join(removed_names, ", ")}"
change = [add, remove] |> Enum.reject(&is_nil/1) |> Enum.join(" and ")

"Are you sure you want to #{change}?"
if change == "" do
# Don't show confirmation message if no changes were made
nil
else
"Are you sure you want to #{change}?"
end
end
end