mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Prevent account deletions when account is linked to a Plaid Item (#2218)
* Prevent account deletions when account is linked to a Plaid Item * Only guard deletions in UI and controller, not at model level
This commit is contained in:
parent
628d266980
commit
a67f36bf64
7 changed files with 39 additions and 25 deletions
|
@ -6,7 +6,10 @@
|
|||
<%= form.hidden_field :return_to, value: params[:return_to] %>
|
||||
|
||||
<%= form.text_field :name, placeholder: t(".name_placeholder"), required: "required", label: t(".name_label") %>
|
||||
<%= form.money_field :balance, label: t(".balance"), required: true, default_currency: Current.family.currency %>
|
||||
|
||||
<% unless account.linked? %>
|
||||
<%= form.money_field :balance, label: t(".balance"), required: true, default_currency: Current.family.currency %>
|
||||
<% end %>
|
||||
|
||||
<%= yield form %>
|
||||
</div>
|
||||
|
|
|
@ -13,13 +13,15 @@
|
|||
) %>
|
||||
<% end %>
|
||||
|
||||
<% menu.with_item(
|
||||
variant: "button",
|
||||
text: "Delete account",
|
||||
href: account_path(account),
|
||||
method: :delete,
|
||||
icon: "trash-2",
|
||||
confirm: CustomConfirm.for_resource_deletion("account", high_severity: true),
|
||||
data: { turbo_frame: :_top }
|
||||
) %>
|
||||
<% unless account.linked? %>
|
||||
<% menu.with_item(
|
||||
variant: "button",
|
||||
text: "Delete account",
|
||||
href: account_path(account),
|
||||
method: :delete,
|
||||
icon: "trash-2",
|
||||
confirm: CustomConfirm.for_resource_deletion("account", high_severity: true),
|
||||
data: { turbo_frame: :_top }
|
||||
) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<%= family_stream %>
|
||||
<% if Current.family %>
|
||||
<%= turbo_stream_from Current.family %>
|
||||
<% end %>
|
||||
|
||||
<%= turbo_frame_tag "modal" %>
|
||||
<%= turbo_frame_tag "drawer" %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%# locals: (message:) %>
|
||||
|
||||
<%= tag.div class: "flex gap-3 rounded-lg bg-container-inset p-4 group w-full md:max-w-80 shadow-border-lg",
|
||||
<%= tag.div class: "flex gap-3 rounded-lg bg-container p-4 group w-full md:max-w-80 shadow-border-lg",
|
||||
data: { controller: "element-removal" } do %>
|
||||
<div class="h-5 w-5 shrink-0 p-px text-primary">
|
||||
<div class="flex h-full items-center justify-center rounded-full bg-destructive">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue