From 54845af56871f8ddb371a8329c77a04d2b7a1767 Mon Sep 17 00:00:00 2001 From: JannikStreek Date: Mon, 23 Dec 2024 07:38:57 +0100 Subject: [PATCH] fix modal closings when bainstorming changes (#531) --- lib/mindwendel/local_storage.ex | 2 +- lib/mindwendel/permissions.ex | 4 ++-- .../live/brainstorming_live/share_component.ex | 4 +++- .../share_component.html.heex | 2 +- .../live/brainstorming_live/show.ex | 7 ++----- .../live/brainstorming_live/show.html.heex | 17 +++++++++-------- .../live/comment_live/form_component.ex | 12 ++++++------ .../live/comment_live/show_component.ex | 5 +++-- .../live/comment_live/show_component.html.heex | 4 ++-- .../live/idea_live/card_component.ex | 2 +- .../live/idea_live/card_component.html.heex | 2 +- .../live/idea_live/form_component.ex | 10 +++++----- .../live/idea_live/form_component.html.heex | 2 +- .../live/idea_live/show_component.html.heex | 4 ++-- .../live/label_live/captions_component.ex | 2 +- .../label_live/captions_component.html.heex | 4 ++-- .../live/lane_live/form_component.ex | 13 +++++++------ .../live/lane_live/form_component.html.heex | 2 +- .../live/lane_live/index_component.ex | 2 +- .../live/lane_live/index_component.html.heex | 2 +- lib/mindwendel_web/live/live_helpers.ex | 11 ++++++----- priv/gettext/de/LC_MESSAGES/default.po | 12 ++++++------ priv/gettext/default.pot | 12 ++++++------ priv/gettext/en/LC_MESSAGES/default.po | 12 ++++++------ test/mindwendel/permissions_test.exs | 4 ++-- 25 files changed, 78 insertions(+), 75 deletions(-) diff --git a/lib/mindwendel/local_storage.ex b/lib/mindwendel/local_storage.ex index 658e5c2e..a02dbe51 100644 --- a/lib/mindwendel/local_storage.ex +++ b/lib/mindwendel/local_storage.ex @@ -38,7 +38,7 @@ defmodule Mindwendel.LocalStorage do "name" => brainstorming.name, "id" => brainstorming.id, "admin_url_id" => - if(Permissions.has_moderating_permission(brainstorming, user), + if(Permissions.has_moderating_permission(brainstorming.id, user), do: brainstorming.admin_url_id, else: nil ) diff --git a/lib/mindwendel/permissions.ex b/lib/mindwendel/permissions.ex index 790bb28b..184251d2 100644 --- a/lib/mindwendel/permissions.ex +++ b/lib/mindwendel/permissions.ex @@ -2,8 +2,8 @@ defmodule Mindwendel.Permissions do @moduledoc """ The Permissions context. """ - def has_moderating_permission(brainstorming, current_user) when current_user != nil do - Enum.member?(current_user.moderated_brainstormings |> Enum.map(& &1.id), brainstorming.id) + def has_moderating_permission(brainstorming_id, current_user) when current_user != nil do + Enum.member?(current_user.moderated_brainstormings |> Enum.map(& &1.id), brainstorming_id) end def has_moderating_permission(_, _) do diff --git a/lib/mindwendel_web/live/brainstorming_live/share_component.ex b/lib/mindwendel_web/live/brainstorming_live/share_component.ex index 9c863c57..288d910b 100644 --- a/lib/mindwendel_web/live/brainstorming_live/share_component.ex +++ b/lib/mindwendel_web/live/brainstorming_live/share_component.ex @@ -1,10 +1,12 @@ defmodule MindwendelWeb.BrainstormingLive.ShareComponent do use MindwendelWeb, :live_component + alias Mindwendel.Permissions + def handle_event("toggle_url_secret", _value, socket) do %{brainstorming: brainstorming, uri: uri, current_user: current_user} = socket.assigns - if has_moderating_permission(brainstorming, current_user) do + if Permissions.has_moderating_permission(brainstorming.id, current_user) do new_uri = create_download_link(brainstorming, uri) {:noreply, assign(socket, :uri, new_uri)} else diff --git a/lib/mindwendel_web/live/brainstorming_live/share_component.html.heex b/lib/mindwendel_web/live/brainstorming_live/share_component.html.heex index ffac7ac5..ae66b9b0 100644 --- a/lib/mindwendel_web/live/brainstorming_live/share_component.html.heex +++ b/lib/mindwendel_web/live/brainstorming_live/share_component.html.heex @@ -31,7 +31,7 @@
- <%= if has_moderating_permission(@brainstorming, @current_user) do %> + <%= if has_moderating_permission(@brainstorming.id, @current_user) do %> <.input name="admin_url_id" type="checkbox" diff --git a/lib/mindwendel_web/live/brainstorming_live/show.ex b/lib/mindwendel_web/live/brainstorming_live/show.ex index e73d9e82..e0160ba7 100644 --- a/lib/mindwendel_web/live/brainstorming_live/show.ex +++ b/lib/mindwendel_web/live/brainstorming_live/show.ex @@ -134,11 +134,8 @@ defmodule MindwendelWeb.BrainstormingLive.Show do # therefore we patch the url to reload it {:noreply, - push_patch( - socket - |> assign(:brainstorming, brainstorming), - to: "/brainstormings/#{brainstorming.id}" - )} + socket + |> assign(:brainstorming, brainstorming)} end def handle_info({:user_updated, user}, socket) do diff --git a/lib/mindwendel_web/live/brainstorming_live/show.html.heex b/lib/mindwendel_web/live/brainstorming_live/show.html.heex index 52f53bae..eb752187 100644 --- a/lib/mindwendel_web/live/brainstorming_live/show.html.heex +++ b/lib/mindwendel_web/live/brainstorming_live/show.html.heex @@ -16,7 +16,7 @@ data-name={@brainstorming.name} data-last-accessed-at={@brainstorming.last_accessed_at} data-admin-url-id={ - if has_moderating_permission(@brainstorming, @current_user), + if has_moderating_permission(@brainstorming.id, @current_user), do: @brainstorming.admin_url_id, else: nil } @@ -30,7 +30,7 @@
- <%= if has_moderating_permission(@brainstorming, @current_user) do %> + <%= if has_moderating_permission(@brainstorming.id, @current_user) do %> <.link patch={~p"/brainstormings/#{@brainstorming.id}/new_lane"} class="btn btn-primary m-1 d-inline-flex align-items-center" @@ -48,7 +48,7 @@ - <%= if has_moderating_permission(@brainstorming, @current_user) do %> + <%= if has_moderating_permission(@brainstorming.id, @current_user) do %> <.link href={~p"/admin/brainstormings/#{@brainstorming.admin_url_id}/edit"} class="btn btn-secondary m-1" @@ -96,7 +96,7 @@ module={MindwendelWeb.IdeaLive.FormComponent} id={:new} action={:new} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming.id} filtered_labels={@filtered_labels} current_user={@current_user} idea={@idea} @@ -114,7 +114,7 @@ module={MindwendelWeb.IdeaLive.ShowComponent} id={:show} action={:show} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming.id} current_user={@current_user} idea={@idea} /> @@ -131,7 +131,7 @@ module={MindwendelWeb.LaneLive.FormComponent} id={:new} action={:new} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming.id} current_user={@current_user} lane={@lane} /> @@ -148,7 +148,7 @@ module={MindwendelWeb.IdeaLive.FormComponent} id={:update} action={:update} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming.id} current_user={@current_user} idea={@idea} /> @@ -165,7 +165,7 @@ module={MindwendelWeb.LaneLive.FormComponent} id={:update} action={:update} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming.id} current_user={@current_user} lane={@lane} /> @@ -176,6 +176,7 @@ show on_cancel={JS.patch(~p"/brainstormings/#{@brainstorming.id}")} title={gettext("Share brainstorming")} + phx_update="ignore" > <.live_component module={MindwendelWeb.BrainstormingLive.ShareComponent} diff --git a/lib/mindwendel_web/live/comment_live/form_component.ex b/lib/mindwendel_web/live/comment_live/form_component.ex index be51c4c2..cd40000c 100644 --- a/lib/mindwendel_web/live/comment_live/form_component.ex +++ b/lib/mindwendel_web/live/comment_live/form_component.ex @@ -39,15 +39,14 @@ defmodule MindwendelWeb.CommentLive.FormComponent do def handle_event("close", _, socket) do # The close button is either pressed inside the comment component, where a comment might be edited, or inside the "new comment" form. # Depending on the location, either patch back to the brainstorming or simply change back to view mode inside the comment. - %{brainstorming: brainstorming, comment: comment} = socket.assigns + %{brainstorming_id: brainstorming_id, comment: comment} = socket.assigns case socket.assigns.action do :new -> {:noreply, push_patch( - socket - |> assign(:brainstorming, brainstorming), - to: "/brainstormings/#{brainstorming.id}" + socket, + to: "/brainstormings/#{brainstorming_id}" )} :update -> @@ -67,9 +66,10 @@ defmodule MindwendelWeb.CommentLive.FormComponent do end defp save_comment(socket, :update, comment_params) do - %{current_user: current_user, comment: comment, brainstorming: brainstorming} = socket.assigns + %{current_user: current_user, comment: comment, brainstorming_id: brainstorming_id} = + socket.assigns - if has_moderating_or_ownership_permission(brainstorming, comment, current_user) do + if has_moderating_or_ownership_permission(brainstorming_id, comment, current_user) do comment_params_merged = comment_params |> Map.put("user_id", comment.user_id || current_user.id) diff --git a/lib/mindwendel_web/live/comment_live/show_component.ex b/lib/mindwendel_web/live/comment_live/show_component.ex index 758b4130..43d13536 100644 --- a/lib/mindwendel_web/live/comment_live/show_component.ex +++ b/lib/mindwendel_web/live/comment_live/show_component.ex @@ -8,9 +8,10 @@ defmodule MindwendelWeb.CommentLive.ShowComponent do end def handle_event("delete_comment", _, socket) do - %{brainstorming: brainstorming, comment: comment, current_user: current_user} = socket.assigns + %{brainstorming_id: brainstorming_id, comment: comment, current_user: current_user} = + socket.assigns - if has_moderating_or_ownership_permission(brainstorming, comment, current_user) do + if has_moderating_or_ownership_permission(brainstorming_id, comment, current_user) do Comments.delete_comment(socket.assigns.comment) end diff --git a/lib/mindwendel_web/live/comment_live/show_component.html.heex b/lib/mindwendel_web/live/comment_live/show_component.html.heex index fb6937f0..1e0831e6 100644 --- a/lib/mindwendel_web/live/comment_live/show_component.html.heex +++ b/lib/mindwendel_web/live/comment_live/show_component.html.heex @@ -4,7 +4,7 @@ <.live_component module={MindwendelWeb.CommentLive.FormComponent} id={"comment-form-#{@comment.id}"} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming_id} current_user={@current_user} comment={@comment} idea={@idea} @@ -12,7 +12,7 @@ /> <% else %>
- <%= if has_moderating_or_ownership_permission(@brainstorming, @comment, @current_user) do %> + <%= if has_moderating_or_ownership_permission(@brainstorming_id, @comment, @current_user) do %> <.link class="float-end ms-3 mb-3" phx-click="delete_comment" diff --git a/lib/mindwendel_web/live/idea_live/card_component.ex b/lib/mindwendel_web/live/idea_live/card_component.ex index 7ae6305c..9a3c1b55 100644 --- a/lib/mindwendel_web/live/idea_live/card_component.ex +++ b/lib/mindwendel_web/live/idea_live/card_component.ex @@ -11,7 +11,7 @@ defmodule MindwendelWeb.IdeaLive.CardComponent do %{current_user: current_user, brainstorming: brainstorming} = socket.assigns - if has_moderating_or_ownership_permission(brainstorming, idea, current_user) do + if has_moderating_or_ownership_permission(brainstorming.id, idea, current_user) do {:ok, _} = Ideas.delete_idea(idea) end diff --git a/lib/mindwendel_web/live/idea_live/card_component.html.heex b/lib/mindwendel_web/live/idea_live/card_component.html.heex index 3518257c..07a84bee 100644 --- a/lib/mindwendel_web/live/idea_live/card_component.html.heex +++ b/lib/mindwendel_web/live/idea_live/card_component.html.heex @@ -8,7 +8,7 @@ data-position={@idea.position_order} >
- <%= if has_moderating_or_ownership_permission(@brainstorming, @idea, @current_user) do %> + <%= if has_moderating_or_ownership_permission(@brainstorming.id, @idea, @current_user) do %> <.link class="float-end ms-3 mb-3" phx-click="delete_idea" diff --git a/lib/mindwendel_web/live/idea_live/form_component.ex b/lib/mindwendel_web/live/idea_live/form_component.ex index 6aec00b7..eaaca729 100644 --- a/lib/mindwendel_web/live/idea_live/form_component.ex +++ b/lib/mindwendel_web/live/idea_live/form_component.ex @@ -44,9 +44,9 @@ defmodule MindwendelWeb.IdeaLive.FormComponent do end def handle_event("delete_attachment", %{"id" => id}, socket) do - %{current_user: current_user, brainstorming: brainstorming, idea: idea} = socket.assigns + %{current_user: current_user, brainstorming_id: brainstorming_id, idea: idea} = socket.assigns - if has_moderating_or_ownership_permission(brainstorming, idea, current_user) do + if has_moderating_or_ownership_permission(brainstorming_id, idea, current_user) do attachment = Attachments.get_attached_file(id) Attachments.delete_attached_file(attachment) end @@ -57,9 +57,9 @@ defmodule MindwendelWeb.IdeaLive.FormComponent do defp save_idea(socket, :update, idea_params) do idea = Ideas.get_idea!(idea_params["id"]) - %{current_user: current_user, brainstorming: brainstorming} = socket.assigns + %{current_user: current_user, brainstorming_id: brainstorming_id} = socket.assigns - if has_moderating_or_ownership_permission(brainstorming, idea, current_user) do + if has_moderating_or_ownership_permission(brainstorming_id, idea, current_user) do tmp_attachments = prepare_attachments(socket) idea_params_merged = @@ -75,7 +75,7 @@ defmodule MindwendelWeb.IdeaLive.FormComponent do {:noreply, socket |> put_flash(:info, gettext("Idea updated")) - |> push_patch(to: ~p"/brainstormings/#{brainstorming.id}")} + |> push_patch(to: ~p"/brainstormings/#{brainstorming_id}")} {:error, %Ecto.Changeset{} = changeset} -> remove_tmp_attachments(tmp_attachments) diff --git a/lib/mindwendel_web/live/idea_live/form_component.html.heex b/lib/mindwendel_web/live/idea_live/form_component.html.heex index 5750fc22..8ae382bf 100644 --- a/lib/mindwendel_web/live/idea_live/form_component.html.heex +++ b/lib/mindwendel_web/live/idea_live/form_component.html.heex @@ -50,7 +50,7 @@ <.input field={@form[:lane_id]} type="hidden" /> <:actions> <.link - patch={~p"/brainstormings/#{@brainstorming.id}"} + patch={~p"/brainstormings/#{@brainstorming_id}"} class="btn btn-secondary form-cancel me-2" title={gettext("Close")} > diff --git a/lib/mindwendel_web/live/idea_live/show_component.html.heex b/lib/mindwendel_web/live/idea_live/show_component.html.heex index 919f2204..e61ceded 100644 --- a/lib/mindwendel_web/live/idea_live/show_component.html.heex +++ b/lib/mindwendel_web/live/idea_live/show_component.html.heex @@ -38,7 +38,7 @@ id={comment.id} comment={comment} idea={@idea} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming_id} current_user={@current_user} live_action={:show} /> @@ -54,7 +54,7 @@ <.live_component module={MindwendelWeb.CommentLive.FormComponent} id={:new} - brainstorming={@brainstorming} + brainstorming_id={@brainstorming_id} current_user={@current_user} idea={@idea} action={:new} diff --git a/lib/mindwendel_web/live/label_live/captions_component.ex b/lib/mindwendel_web/live/label_live/captions_component.ex index 26c5f84d..5a1014c3 100644 --- a/lib/mindwendel_web/live/label_live/captions_component.ex +++ b/lib/mindwendel_web/live/label_live/captions_component.ex @@ -7,7 +7,7 @@ defmodule MindwendelWeb.LabelLive.CaptionsComponent do %{current_user: current_user, brainstorming: brainstorming, filtered_labels: filtered_labels} = socket.assigns - if has_moderating_permission(brainstorming, current_user) do + if has_moderating_permission(brainstorming.id, current_user) do # If the filter is already present, remove it as its toggled. If not, add it. toggled_filters = build_filter_labels(filtered_labels, idea_label_id) diff --git a/lib/mindwendel_web/live/label_live/captions_component.html.heex b/lib/mindwendel_web/live/label_live/captions_component.html.heex index 56b626f1..519d3d2c 100644 --- a/lib/mindwendel_web/live/label_live/captions_component.html.heex +++ b/lib/mindwendel_web/live/label_live/captions_component.html.heex @@ -7,12 +7,12 @@ color={brainstorming_idea_label.color} label_id={brainstorming_idea_label.id} phx-target={@myself} - disabled={!has_moderating_permission(@brainstorming, @current_user)} + disabled={!has_moderating_permission(@brainstorming.id, @current_user)} > {brainstorming_idea_label.name} <% end %> - <%= if has_moderating_permission(@brainstorming, @current_user) do %> + <%= if has_moderating_permission(@brainstorming.id, @current_user) do %> <.filter_button label_id="filter-label-reset" color="grey" diff --git a/lib/mindwendel_web/live/lane_live/form_component.ex b/lib/mindwendel_web/live/lane_live/form_component.ex index 0984b027..dc038509 100644 --- a/lib/mindwendel_web/live/lane_live/form_component.ex +++ b/lib/mindwendel_web/live/lane_live/form_component.ex @@ -2,6 +2,7 @@ defmodule MindwendelWeb.LaneLive.FormComponent do use MindwendelWeb, :live_component alias Mindwendel.Lanes + alias Mindwendel.Permissions @impl true def update(%{lane: lane} = assigns, socket) do @@ -24,9 +25,9 @@ defmodule MindwendelWeb.LaneLive.FormComponent do end def handle_event("save", %{"lane" => lane_params}, socket) do - %{current_user: current_user, brainstorming: brainstorming} = socket.assigns + %{current_user: current_user, brainstorming_id: brainstorming_id} = socket.assigns - if has_moderating_permission(brainstorming, current_user) do + if Permissions.has_moderating_permission(brainstorming_id, current_user) do save_lane(socket, socket.assigns.action, lane_params) else {:noreply, socket} @@ -36,7 +37,7 @@ defmodule MindwendelWeb.LaneLive.FormComponent do defp save_lane(socket, :update, lane_params) do lane = Lanes.get_lane!(lane_params["id"]) - %{brainstorming: brainstorming} = socket.assigns + %{brainstorming_id: brainstorming_id} = socket.assigns case Lanes.update_lane(lane, lane_params) do {:ok, _lane} -> @@ -44,7 +45,7 @@ defmodule MindwendelWeb.LaneLive.FormComponent do socket |> put_flash(:info, gettext("Lane updated")) |> push_event("submit-success", %{to: "#lane-modal"}) - |> push_navigate(to: ~p"/brainstormings/#{brainstorming.id}")} + |> push_navigate(to: ~p"/brainstormings/#{brainstorming_id}")} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} @@ -52,7 +53,7 @@ defmodule MindwendelWeb.LaneLive.FormComponent do end defp save_lane(socket, :new, lane_params) do - %{brainstorming: brainstorming} = socket.assigns + %{brainstorming_id: brainstorming_id} = socket.assigns case Lanes.create_lane(lane_params) do {:ok, _lane} -> @@ -60,7 +61,7 @@ defmodule MindwendelWeb.LaneLive.FormComponent do socket |> put_flash(:info, gettext("Lane created successfully")) |> push_event("submit-success", %{to: "#lane-modal"}) - |> push_navigate(to: ~p"/brainstormings/#{brainstorming.id}")} + |> push_navigate(to: ~p"/brainstormings/#{brainstorming_id}")} {:error, %Ecto.Changeset{} = changeset} -> {:noreply, assign(socket, form: to_form(changeset))} diff --git a/lib/mindwendel_web/live/lane_live/form_component.html.heex b/lib/mindwendel_web/live/lane_live/form_component.html.heex index 300c1df4..a27aada0 100644 --- a/lib/mindwendel_web/live/lane_live/form_component.html.heex +++ b/lib/mindwendel_web/live/lane_live/form_component.html.heex @@ -11,7 +11,7 @@ <.input field={@form[:name]} type="text" label={gettext("Name")} phx-debounce={300} /> <:actions> <.link - patch={~p"/brainstormings/#{@brainstorming.id}"} + patch={~p"/brainstormings/#{@brainstorming_id}"} class="btn btn-secondary form-cancel me-2" title={gettext("Close")} > diff --git a/lib/mindwendel_web/live/lane_live/index_component.ex b/lib/mindwendel_web/live/lane_live/index_component.ex index c16504ca..8058fc54 100644 --- a/lib/mindwendel_web/live/lane_live/index_component.ex +++ b/lib/mindwendel_web/live/lane_live/index_component.ex @@ -12,7 +12,7 @@ defmodule MindwendelWeb.LaneLive.IndexComponent do %{current_user: current_user, brainstorming: brainstorming} = socket.assigns - if has_moderating_permission(brainstorming, current_user) do + if has_moderating_permission(brainstorming.id, current_user) do {:ok, _} = Lanes.delete_lane(lane) end diff --git a/lib/mindwendel_web/live/lane_live/index_component.html.heex b/lib/mindwendel_web/live/lane_live/index_component.html.heex index e37da566..1b927298 100644 --- a/lib/mindwendel_web/live/lane_live/index_component.html.heex +++ b/lib/mindwendel_web/live/lane_live/index_component.html.heex @@ -30,7 +30,7 @@ else: "" moderating_disabled = - unless has_moderating_permission(@brainstorming, @current_user), + unless has_moderating_permission(@brainstorming.id, @current_user), do: "disabled", else: "" %> <.link diff --git a/lib/mindwendel_web/live/live_helpers.ex b/lib/mindwendel_web/live/live_helpers.ex index d662cab4..f07bb507 100644 --- a/lib/mindwendel_web/live/live_helpers.ex +++ b/lib/mindwendel_web/live/live_helpers.ex @@ -7,11 +7,11 @@ defmodule MindwendelWeb.LiveHelpers do def has_move_permission(brainstorming, current_user) do brainstorming.option_allow_manual_ordering or - has_moderating_permission(brainstorming, current_user) + has_moderating_permission(brainstorming.id, current_user) end - def has_moderating_permission(brainstorming, current_user) do - Permissions.has_moderating_permission(brainstorming, current_user) + def has_moderating_permission(brainstorming_id, current_user) do + Permissions.has_moderating_permission(brainstorming_id, current_user) end def has_ownership(record, current_user) do @@ -19,8 +19,9 @@ defmodule MindwendelWeb.LiveHelpers do user_id == current_user.id end - def has_moderating_or_ownership_permission(brainstorming, record, current_user) do - has_ownership(record, current_user) or has_moderating_permission(brainstorming, current_user) + def has_moderating_or_ownership_permission(brainstorming_id, record, current_user) do + has_ownership(record, current_user) or + has_moderating_permission(brainstorming_id, current_user) end def uuid do diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index 566b3ffc..06513b07 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -26,12 +26,12 @@ msgstr "Wie können wir ..." msgid "Ready?" msgstr "Fertig?" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:200 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:197 #, elixir-autogen, elixir-format msgid "%{name} - Edit" msgstr "%{name} - Editieren" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:177 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:174 #, elixir-autogen, elixir-format msgid "%{name} - New Idea" msgstr "%{name} - Neue Idee" @@ -299,7 +299,7 @@ msgstr "Bist du sicher, dass das Brainstorming geleert werden soll?" msgid "Empty brainstorming" msgstr "Leere das Brainstorming" -#: lib/mindwendel_web/live/live_helpers.ex:31 +#: lib/mindwendel_web/live/live_helpers.ex:32 #, elixir-autogen, elixir-format, fuzzy msgid "Brainstorming will be deleted %{days}" msgstr "Brainstorming wird gelöscht %{days}" @@ -385,12 +385,12 @@ msgstr "Löschen" msgid "Type the label name" msgstr "Gebe dem Label einen Namen" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:187 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:184 #, elixir-autogen, elixir-format, fuzzy msgid "%{name} - New Lane" msgstr "%{name} - Neue Idee" -#: lib/mindwendel_web/live/lane_live/form_component.ex:61 +#: lib/mindwendel_web/live/lane_live/form_component.ex:62 #, elixir-autogen, elixir-format, fuzzy msgid "Lane created successfully" msgstr "Spalte erfolgreich erstellt" @@ -430,7 +430,7 @@ msgstr "Löschen" msgid "Edit lane" msgstr "Spalte bearbeiten" -#: lib/mindwendel_web/live/lane_live/form_component.ex:45 +#: lib/mindwendel_web/live/lane_live/form_component.ex:46 #, elixir-autogen, elixir-format msgid "Lane updated" msgstr "Spalte aktualisiert" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 89c16423..dbad8d2c 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -25,12 +25,12 @@ msgstr "" msgid "Ready?" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:200 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:197 #, elixir-autogen, elixir-format msgid "%{name} - Edit" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:177 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:174 #, elixir-autogen, elixir-format msgid "%{name} - New Idea" msgstr "" @@ -298,7 +298,7 @@ msgstr "" msgid "Empty brainstorming" msgstr "" -#: lib/mindwendel_web/live/live_helpers.ex:31 +#: lib/mindwendel_web/live/live_helpers.ex:32 #, elixir-autogen, elixir-format msgid "Brainstorming will be deleted %{days}" msgstr "" @@ -384,12 +384,12 @@ msgstr "" msgid "Type the label name" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:187 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:184 #, elixir-autogen, elixir-format msgid "%{name} - New Lane" msgstr "" -#: lib/mindwendel_web/live/lane_live/form_component.ex:61 +#: lib/mindwendel_web/live/lane_live/form_component.ex:62 #, elixir-autogen, elixir-format msgid "Lane created successfully" msgstr "" @@ -429,7 +429,7 @@ msgstr "" msgid "Edit lane" msgstr "" -#: lib/mindwendel_web/live/lane_live/form_component.ex:45 +#: lib/mindwendel_web/live/lane_live/form_component.ex:46 #, elixir-autogen, elixir-format msgid "Lane updated" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index bb844c35..d44ce3ba 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -26,12 +26,12 @@ msgstr "" msgid "Ready?" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:200 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:197 #, elixir-autogen, elixir-format msgid "%{name} - Edit" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:177 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:174 #, elixir-autogen, elixir-format msgid "%{name} - New Idea" msgstr "" @@ -299,7 +299,7 @@ msgstr "Are you sure that you want to delete this brainstorming?" msgid "Empty brainstorming" msgstr "" -#: lib/mindwendel_web/live/live_helpers.ex:31 +#: lib/mindwendel_web/live/live_helpers.ex:32 #, elixir-autogen, elixir-format, fuzzy msgid "Brainstorming will be deleted %{days}" msgstr "" @@ -385,12 +385,12 @@ msgstr "" msgid "Type the label name" msgstr "" -#: lib/mindwendel_web/live/brainstorming_live/show.ex:187 +#: lib/mindwendel_web/live/brainstorming_live/show.ex:184 #, elixir-autogen, elixir-format, fuzzy msgid "%{name} - New Lane" msgstr "" -#: lib/mindwendel_web/live/lane_live/form_component.ex:61 +#: lib/mindwendel_web/live/lane_live/form_component.ex:62 #, elixir-autogen, elixir-format, fuzzy msgid "Lane created successfully" msgstr "" @@ -430,7 +430,7 @@ msgstr "" msgid "Edit lane" msgstr "" -#: lib/mindwendel_web/live/lane_live/form_component.ex:45 +#: lib/mindwendel_web/live/lane_live/form_component.ex:46 #, elixir-autogen, elixir-format msgid "Lane updated" msgstr "" diff --git a/test/mindwendel/permissions_test.exs b/test/mindwendel/permissions_test.exs index c1360340..9baf6324 100644 --- a/test/mindwendel/permissions_test.exs +++ b/test/mindwendel/permissions_test.exs @@ -11,7 +11,7 @@ defmodule Mindwendel.PermissionsTest do Accounts.add_moderating_user(brainstorming, moderating_user) assert Permissions.has_moderating_permission( - brainstorming, + brainstorming.id, Accounts.get_user(moderating_user.id) ) end @@ -19,7 +19,7 @@ defmodule Mindwendel.PermissionsTest do test "returns false if user is not moderating" do user = Factory.insert!(:user) brainstorming = Factory.insert!(:brainstorming) - refute Permissions.has_moderating_permission(brainstorming, Accounts.get_user(user.id)) + refute Permissions.has_moderating_permission(brainstorming.id, Accounts.get_user(user.id)) end end end