diff --git a/changelog.md b/changelog.md index afc53e6..6d838ca 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# v0.1.19 +- Fix visibility issues with multiple users + # v0.1.18 - Update deps - Fix content not escaping HTML properly diff --git a/lib/memex/contexts.ex b/lib/memex/contexts.ex index c9ec67b..72255a9 100644 --- a/lib/memex/contexts.ex +++ b/lib/memex/contexts.ex @@ -22,16 +22,16 @@ defmodule Memex.Contexts do @spec list_contexts(search :: String.t() | nil, User.t()) :: [Context.t()] def list_contexts(search \\ nil, user) - def list_contexts(search, %{id: user_id}) when search in [nil, ""] do - Repo.all(from c in Context, where: c.user_id == ^user_id, order_by: c.slug) + def list_contexts(search, %{id: user_id}) when user_id |> is_binary() and search in [nil, ""] do + Repo.all(from c in Context, order_by: c.slug) end - def list_contexts(search, %{id: user_id}) when search |> is_binary() do + def list_contexts(search, %{id: user_id}) + when user_id |> is_binary() and search |> is_binary() do trimmed_search = String.trim(search) Repo.all( from c in Context, - where: c.user_id == ^user_id, where: fragment( "search @@ websearch_to_tsquery('english', ?)", @@ -103,12 +103,8 @@ defmodule Memex.Contexts do """ @spec get_context!(Context.id(), User.t()) :: Context.t() - def get_context!(id, %{id: user_id}) do - Repo.one!( - from c in Context, - where: c.id == ^id, - where: c.user_id == ^user_id or c.visibility in [:public, :unlisted] - ) + def get_context!(id, %{id: user_id}) when user_id |> is_binary() do + Repo.one!(from c in Context, where: c.id == ^id) end def get_context!(id, _invalid_user) do @@ -134,12 +130,8 @@ defmodule Memex.Contexts do """ @spec get_context_by_slug(Context.slug(), User.t()) :: Context.t() | nil - def get_context_by_slug(slug, %{id: user_id}) do - Repo.one( - from c in Context, - where: c.slug == ^slug, - where: c.user_id == ^user_id or c.visibility in [:public, :unlisted] - ) + def get_context_by_slug(slug, %{id: user_id}) when user_id |> is_binary() do + Repo.one(from c in Context, where: c.slug == ^slug) end def get_context_by_slug(slug, _invalid_user) do @@ -194,23 +186,16 @@ defmodule Memex.Contexts do ## Examples - iex> delete_context(%Context{user_id: 123}, %User{id: 123}) - {:ok, %Context{}} - - iex> delete_context(%Context{user_id: 123}, %User{role: :admin}) - {:ok, %Context{}} - iex> delete_context(%Context{}, %User{id: 123}) + {:ok, %Context{}} + + iex> delete_context(%Context{}, nil) {:error, %Ecto.Changeset{}} """ @spec delete_context(Context.t(), User.t()) :: {:ok, Context.t()} | {:error, Context.changeset()} - def delete_context(%Context{user_id: user_id} = context, %{id: user_id}) do - context |> Repo.delete() - end - - def delete_context(%Context{} = context, %{role: :admin}) do + def delete_context(%Context{} = context, %{id: user_id}) when user_id |> is_binary() do context |> Repo.delete() end @@ -228,13 +213,4 @@ defmodule Memex.Contexts do def change_context(%Context{} = context, attrs \\ %{}, user) do context |> Context.update_changeset(attrs, user) end - - @spec owner_or_admin?(Context.t(), User.t()) :: boolean() - def owner_or_admin?(%{user_id: user_id}, %{id: user_id}), do: true - def owner_or_admin?(_context, %{role: :admin}), do: true - def owner_or_admin?(_context, _other_user), do: false - - @spec owner?(Context.t(), User.t()) :: boolean() - def owner?(%{user_id: user_id}, %{id: user_id}), do: true - def owner?(_context, _other_user), do: false end diff --git a/lib/memex/contexts/context.ex b/lib/memex/contexts/context.ex index 9be4b1e..fe992d4 100644 --- a/lib/memex/contexts/context.ex +++ b/lib/memex/contexts/context.ex @@ -63,8 +63,9 @@ defmodule Memex.Contexts.Context do end @spec update_changeset(t(), attrs :: map(), User.t()) :: changeset() - def update_changeset(%{user_id: user_id} = note, attrs, %User{id: user_id}) do - note + def update_changeset(%__MODULE__{} = context, attrs, %User{id: user_id}) + when user_id |> is_binary() do + context |> cast(attrs, [:slug, :content, :tags, :visibility]) |> cast_tags_string(attrs) |> validate_format(:slug, ~r/^[\p{L}\p{N}\-]+$/, diff --git a/lib/memex/notes.ex b/lib/memex/notes.ex index 1edbdb0..c58ed68 100644 --- a/lib/memex/notes.ex +++ b/lib/memex/notes.ex @@ -31,7 +31,6 @@ defmodule Memex.Notes do Repo.all( from n in Note, - where: n.user_id == ^user_id, where: fragment( "search @@ websearch_to_tsquery('english', ?)", @@ -102,12 +101,8 @@ defmodule Memex.Notes do """ @spec get_note!(Note.id(), User.t()) :: Note.t() - def get_note!(id, %{id: user_id}) do - Repo.one!( - from n in Note, - where: n.id == ^id, - where: n.user_id == ^user_id or n.visibility in [:public, :unlisted] - ) + def get_note!(id, %{id: user_id}) when user_id |> is_binary() do + Repo.one!(from n in Note, where: n.id == ^id) end def get_note!(id, _invalid_user) do @@ -133,12 +128,8 @@ defmodule Memex.Notes do """ @spec get_note_by_slug(Note.slug(), User.t()) :: Note.t() | nil - def get_note_by_slug(slug, %{id: user_id}) do - Repo.one( - from n in Note, - where: n.slug == ^slug, - where: n.user_id == ^user_id or n.visibility in [:public, :unlisted] - ) + def get_note_by_slug(slug, %{id: user_id}) when user_id |> is_binary() do + Repo.one(from n in Note, where: n.slug == ^slug) end def get_note_by_slug(slug, _invalid_user) do @@ -192,22 +183,15 @@ defmodule Memex.Notes do ## Examples - iex> delete_note(%Note{user_id: 123}, %User{id: 123}) - {:ok, %Note{}} - - iex> delete_note(%Note{}, %User{role: :admin}) - {:ok, %Note{}} - iex> delete_note(%Note{}, %User{id: 123}) + {:ok, %Note{}} + + iex> delete_note(%Note{}, nil) {:error, %Ecto.Changeset{}} """ @spec delete_note(Note.t(), User.t()) :: {:ok, Note.t()} | {:error, Note.changeset()} - def delete_note(%Note{user_id: user_id} = note, %{id: user_id}) do - note |> Repo.delete() - end - - def delete_note(%Note{} = note, %{role: :admin}) do + def delete_note(%Note{} = note, %{id: user_id}) when user_id |> is_binary() do note |> Repo.delete() end @@ -228,13 +212,4 @@ defmodule Memex.Notes do def change_note(%Note{} = note, attrs \\ %{}, user) do note |> Note.update_changeset(attrs, user) end - - @spec owner_or_admin?(Note.t(), User.t()) :: boolean() - def owner_or_admin?(%{user_id: user_id}, %{id: user_id}), do: true - def owner_or_admin?(_context, %{role: :admin}), do: true - def owner_or_admin?(_context, _other_user), do: false - - @spec owner?(Note.t(), User.t()) :: boolean() - def owner?(%{user_id: user_id}, %{id: user_id}), do: true - def owner?(_context, _other_user), do: false end diff --git a/lib/memex/notes/note.ex b/lib/memex/notes/note.ex index 2872e25..5812ed6 100644 --- a/lib/memex/notes/note.ex +++ b/lib/memex/notes/note.ex @@ -62,7 +62,8 @@ defmodule Memex.Notes.Note do end @spec update_changeset(t(), attrs :: map(), User.t()) :: changeset() - def update_changeset(%{user_id: user_id} = note, attrs, %User{id: user_id}) do + def update_changeset(%__MODULE__{} = note, attrs, %User{id: user_id}) + when user_id |> is_binary() do note |> cast(attrs, [:slug, :content, :tags, :visibility]) |> cast_tags_string(attrs) diff --git a/lib/memex/pipelines.ex b/lib/memex/pipelines.ex index c576a8e..922c70d 100644 --- a/lib/memex/pipelines.ex +++ b/lib/memex/pipelines.ex @@ -22,16 +22,17 @@ defmodule Memex.Pipelines do @spec list_pipelines(search :: String.t() | nil, User.t()) :: [Pipeline.t()] def list_pipelines(search \\ nil, user) - def list_pipelines(search, %{id: user_id}) when search in [nil, ""] do - Repo.all(from p in Pipeline, where: p.user_id == ^user_id, order_by: p.slug) + def list_pipelines(search, %{id: user_id}) + when user_id |> is_binary() and search in [nil, ""] do + Repo.all(from p in Pipeline, order_by: p.slug) end - def list_pipelines(search, %{id: user_id}) when search |> is_binary() do + def list_pipelines(search, %{id: user_id}) + when user_id |> is_binary() and search |> is_binary() do trimmed_search = String.trim(search) Repo.all( from p in Pipeline, - where: p.user_id == ^user_id, where: fragment( "search @@ websearch_to_tsquery('english', ?)", @@ -102,12 +103,8 @@ defmodule Memex.Pipelines do """ @spec get_pipeline!(Pipeline.id(), User.t()) :: Pipeline.t() - def get_pipeline!(id, %{id: user_id}) do - Repo.one!( - from p in Pipeline, - where: p.id == ^id, - where: p.user_id == ^user_id or p.visibility in [:public, :unlisted] - ) + def get_pipeline!(id, %{id: user_id}) when user_id |> is_binary() do + Repo.one!(from p in Pipeline, where: p.id == ^id) end def get_pipeline!(id, _invalid_user) do @@ -133,12 +130,8 @@ defmodule Memex.Pipelines do """ @spec get_pipeline_by_slug(Pipeline.slug(), User.t()) :: Pipeline.t() | nil - def get_pipeline_by_slug(slug, %{id: user_id}) do - Repo.one( - from p in Pipeline, - where: p.slug == ^slug, - where: p.user_id == ^user_id or p.visibility in [:public, :unlisted] - ) + def get_pipeline_by_slug(slug, %{id: user_id}) when user_id |> is_binary() do + Repo.one(from p in Pipeline, where: p.slug == ^slug) end def get_pipeline_by_slug(slug, _invalid_user) do @@ -193,23 +186,16 @@ defmodule Memex.Pipelines do ## Examples - iex> delete_pipeline(%Pipeline{user_id: 123}, %User{id: 123}) - {:ok, %Pipeline{}} - - iex> delete_pipeline(%Pipeline{}, %User{role: :admin}) - {:ok, %Pipeline{}} - iex> delete_pipeline(%Pipeline{}, %User{id: 123}) + {:ok, %Pipeline{}} + + iex> delete_pipeline(%Pipeline{}, nil) {:error, %Ecto.Changeset{}} """ @spec delete_pipeline(Pipeline.t(), User.t()) :: {:ok, Pipeline.t()} | {:error, Pipeline.changeset()} - def delete_pipeline(%Pipeline{user_id: user_id} = pipeline, %{id: user_id}) do - pipeline |> Repo.delete() - end - - def delete_pipeline(%Pipeline{} = pipeline, %{role: :admin}) do + def delete_pipeline(%Pipeline{} = pipeline, %{id: user_id}) when user_id |> is_binary() do pipeline |> Repo.delete() end @@ -230,13 +216,4 @@ defmodule Memex.Pipelines do def change_pipeline(%Pipeline{} = pipeline, attrs \\ %{}, user) do pipeline |> Pipeline.update_changeset(attrs, user) end - - @spec owner_or_admin?(Pipeline.t(), User.t()) :: boolean() - def owner_or_admin?(%{user_id: user_id}, %{id: user_id}), do: true - def owner_or_admin?(_context, %{role: :admin}), do: true - def owner_or_admin?(_context, _other_user), do: false - - @spec owner?(Pipeline.t(), User.t()) :: boolean() - def owner?(%{user_id: user_id}, %{id: user_id}), do: true - def owner?(_context, _other_user), do: false end diff --git a/lib/memex/pipelines/pipeline.ex b/lib/memex/pipelines/pipeline.ex index 93de712..2d55554 100644 --- a/lib/memex/pipelines/pipeline.ex +++ b/lib/memex/pipelines/pipeline.ex @@ -65,7 +65,8 @@ defmodule Memex.Pipelines.Pipeline do end @spec update_changeset(t(), attrs :: map(), User.t()) :: changeset() - def update_changeset(%{user_id: user_id} = pipeline, attrs, %User{id: user_id}) do + def update_changeset(%__MODULE__{} = pipeline, attrs, %User{id: user_id}) + when user_id |> is_binary() do pipeline |> cast(attrs, [:slug, :description, :tags, :visibility]) |> cast_tags_string(attrs) diff --git a/lib/memex/pipelines/step.ex b/lib/memex/pipelines/step.ex index 3124add..b416953 100644 --- a/lib/memex/pipelines/step.ex +++ b/lib/memex/pipelines/step.ex @@ -44,9 +44,12 @@ defmodule Memex.Pipelines.Steps.Step do @doc false @spec create_changeset(attrs :: map(), position :: non_neg_integer(), Pipeline.t(), User.t()) :: changeset() - def create_changeset(attrs, position, %Pipeline{id: pipeline_id, user_id: user_id}, %User{ - id: user_id - }) do + def create_changeset( + attrs, + position, + %Pipeline{id: pipeline_id, user_id: user_id}, + %User{id: user_id} + ) do %__MODULE__{} |> cast(attrs, [:title, :content]) |> change(pipeline_id: pipeline_id, user_id: user_id, position: position) @@ -55,22 +58,16 @@ defmodule Memex.Pipelines.Steps.Step do @spec update_changeset(t(), attrs :: map(), User.t()) :: changeset() - def update_changeset( - %{user_id: user_id} = step, - attrs, - %User{id: user_id} - ) do + def update_changeset(%__MODULE__{} = step, attrs, %User{id: user_id}) + when user_id |> is_binary() do step |> cast(attrs, [:title, :content]) |> validate_required([:title, :user_id, :position]) end @spec position_changeset(t(), position :: non_neg_integer(), User.t()) :: changeset() - def position_changeset( - %{user_id: user_id} = step, - position, - %User{id: user_id} - ) do + def position_changeset(%__MODULE__{} = step, position, %User{id: user_id}) + when user_id |> is_binary() do step |> change(position: position) |> validate_required([:title, :user_id, :position]) diff --git a/lib/memex/pipelines/steps.ex b/lib/memex/pipelines/steps.ex index d33de67..80f47e5 100644 --- a/lib/memex/pipelines/steps.ex +++ b/lib/memex/pipelines/steps.ex @@ -21,11 +21,10 @@ defmodule Memex.Pipelines.Steps do """ @spec list_steps(Pipeline.t(), User.t()) :: [Step.t()] - def list_steps(%{id: pipeline_id}, %{id: user_id}) do + def list_steps(%{id: pipeline_id}, %{id: user_id}) when user_id |> is_binary() do Repo.all( from s in Step, where: s.pipeline_id == ^pipeline_id, - where: s.user_id == ^user_id, order_by: s.position ) end @@ -62,8 +61,8 @@ defmodule Memex.Pipelines.Steps do """ @spec get_step!(Step.id(), User.t()) :: Step.t() - def get_step!(id, %{id: user_id}) do - Repo.one!(from n in Step, where: n.id == ^id, where: n.user_id == ^user_id) + def get_step!(id, %{id: user_id}) when user_id |> is_binary() do + Repo.one!(from n in Step, where: n.id == ^id) end def get_step!(id, _invalid_user) do @@ -119,22 +118,15 @@ defmodule Memex.Pipelines.Steps do ## Examples - iex> delete_step(%Step{user_id: 123}, %User{id: 123}) - {:ok, %Step{}} - - iex> delete_step(%Step{}, %User{role: :admin}) - {:ok, %Step{}} - iex> delete_step(%Step{}, %User{id: 123}) + {:ok, %Step{}} + + iex> delete_step(%Step{}, nil) {:error, %Ecto.Changeset{}} """ @spec delete_step(Step.t(), User.t()) :: {:ok, Step.t()} | {:error, Step.changeset()} - def delete_step(%Step{user_id: user_id} = step, %{id: user_id}) do - delete_step(step) - end - - def delete_step(%Step{} = step, %{role: :admin}) do + def delete_step(%Step{} = step, %{id: user_id}) when user_id |> is_binary() do delete_step(step) end @@ -181,10 +173,11 @@ defmodule Memex.Pipelines.Steps do def reorder_step(%Step{position: 0} = step, :up, _user), do: {:error, step} def reorder_step( - %Step{position: position, pipeline_id: pipeline_id, user_id: user_id} = step, + %Step{position: position, pipeline_id: pipeline_id} = step, :up, %{id: user_id} = user - ) do + ) + when user_id |> is_binary() do Multi.new() |> Multi.update_all( :reorder_steps, @@ -207,10 +200,11 @@ defmodule Memex.Pipelines.Steps do end def reorder_step( - %Step{pipeline_id: pipeline_id, position: position, user_id: user_id} = step, + %Step{pipeline_id: pipeline_id, position: position} = step, :down, %{id: user_id} = user - ) do + ) + when user_id |> is_binary() do Multi.new() |> Multi.one( :step_count, diff --git a/lib/memex_web/live/context_live/index.html.heex b/lib/memex_web/live/context_live/index.html.heex index 02a0308..050fe1a 100644 --- a/lib/memex_web/live/context_live/index.html.heex +++ b/lib/memex_web/live/context_live/index.html.heex @@ -1,4 +1,4 @@ -
+

<%= gettext("contexts") %>

@@ -9,7 +9,7 @@ as={:search} phx-change="search" phx-submit="search" - class="self-stretch flex flex-col items-stretch" + class="flex flex-col items-stretch self-stretch" > <%= text_input(f, :search_term, class: "input input-primary", @@ -33,14 +33,14 @@ > <:actions :let={context}> <.link - :if={Contexts.owner?(context, @current_user)} + :if={@current_user} patch={~p"/contexts/#{context}/edit"} aria-label={dgettext("actions", "edit %{context_slug}", context_slug: context.slug)} > <%= dgettext("actions", "edit") %> <.link - :if={Contexts.owner_or_admin?(context, @current_user)} + :if={@current_user} href="#" phx-click="delete" phx-value-id={context.id} diff --git a/lib/memex_web/live/context_live/show.html.heex b/lib/memex_web/live/context_live/show.html.heex index 2e1d9a0..7ec2130 100644 --- a/lib/memex_web/live/context_live/show.html.heex +++ b/lib/memex_web/live/context_live/show.html.heex @@ -1,4 +1,4 @@ -
+

<%= @context.slug %>

@@ -15,16 +15,12 @@ <%= gettext("Visibility: %{visibility}", visibility: @context.visibility) %>

-
- <.link - :if={Contexts.owner?(@context, @current_user)} - class="btn btn-primary" - patch={~p"/context/#{@context}/edit"} - > +
+ <.link :if={@current_user} class="btn btn-primary" patch={~p"/context/#{@context}/edit"}> <%= dgettext("actions", "edit") %> <% end %> <%= if position >= length(@steps) - 1 do %> - + <% else %> <% end %> @@ -113,7 +109,7 @@ <% end %> <.link - :if={Pipelines.owner?(@pipeline, @current_user)} + :if={@current_user} class="self-end btn btn-primary" patch={~p"/pipeline/#{@pipeline}/add_step"} > diff --git a/mix.exs b/mix.exs index 86dd9ea..0d4fa84 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Memex.MixProject do def project do [ app: :memex, - version: "0.1.18", + version: "0.1.19", elixir: "1.18.1", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot index 2cfb7a0..67e8b99 100644 --- a/priv/gettext/actions.pot +++ b/priv/gettext/actions.pot @@ -40,12 +40,12 @@ msgid "create invite" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:50 -#: lib/memex_web/live/context_live/show.html.heex:34 +#: lib/memex_web/live/context_live/show.html.heex:30 #: lib/memex_web/live/note_live/index.html.heex:50 -#: lib/memex_web/live/note_live/show.html.heex:34 +#: lib/memex_web/live/note_live/show.html.heex:30 #: lib/memex_web/live/pipeline_live/index.html.heex:52 -#: lib/memex_web/live/pipeline_live/show.html.heex:34 -#: lib/memex_web/live/pipeline_live/show.html.heex:105 +#: lib/memex_web/live/pipeline_live/show.html.heex:30 +#: lib/memex_web/live/pipeline_live/show.html.heex:101 #, elixir-autogen, elixir-format msgid "delete" msgstr "" @@ -56,12 +56,12 @@ msgid "delete user" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:40 -#: lib/memex_web/live/context_live/show.html.heex:24 +#: lib/memex_web/live/context_live/show.html.heex:20 #: lib/memex_web/live/note_live/index.html.heex:40 -#: lib/memex_web/live/note_live/show.html.heex:24 +#: lib/memex_web/live/note_live/show.html.heex:20 #: lib/memex_web/live/pipeline_live/index.html.heex:40 -#: lib/memex_web/live/pipeline_live/show.html.heex:24 -#: lib/memex_web/live/pipeline_live/show.html.heex:94 +#: lib/memex_web/live/pipeline_live/show.html.heex:20 +#: lib/memex_web/live/pipeline_live/show.html.heex:90 #, elixir-autogen, elixir-format msgid "edit" msgstr "" @@ -112,7 +112,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:120 +#: lib/memex_web/live/pipeline_live/show.html.heex:116 #, elixir-autogen, elixir-format msgid "add step" msgstr "" @@ -145,24 +145,24 @@ msgid "copy invite link for %{invite_name}" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:48 -#: lib/memex_web/live/context_live/show.html.heex:32 +#: lib/memex_web/live/context_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{context_slug}" msgstr "" #: lib/memex_web/live/note_live/index.html.heex:48 -#: lib/memex_web/live/note_live/show.html.heex:32 +#: lib/memex_web/live/note_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{note_slug}" msgstr "" #: lib/memex_web/live/pipeline_live/index.html.heex:49 -#: lib/memex_web/live/pipeline_live/show.html.heex:32 +#: lib/memex_web/live/pipeline_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:103 +#: lib/memex_web/live/pipeline_live/show.html.heex:99 #, elixir-autogen, elixir-format msgid "delete %{step_title}" msgstr "" @@ -187,7 +187,7 @@ msgstr "" msgid "edit %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:92 +#: lib/memex_web/live/pipeline_live/show.html.heex:88 #, elixir-autogen, elixir-format msgid "edit %{step_title}" msgstr "" @@ -197,12 +197,12 @@ msgstr "" msgid "edit invite for %{invite_name}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:82 +#: lib/memex_web/live/pipeline_live/show.html.heex:78 #, elixir-autogen, elixir-format msgid "move %{step_title} down" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:66 +#: lib/memex_web/live/pipeline_live/show.html.heex:62 #, elixir-autogen, elixir-format msgid "move %{step_title} up" msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/actions.po b/priv/gettext/de/LC_MESSAGES/actions.po index 65d9149..1f61e1f 100644 --- a/priv/gettext/de/LC_MESSAGES/actions.po +++ b/priv/gettext/de/LC_MESSAGES/actions.po @@ -40,12 +40,12 @@ msgid "create invite" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:50 -#: lib/memex_web/live/context_live/show.html.heex:34 +#: lib/memex_web/live/context_live/show.html.heex:30 #: lib/memex_web/live/note_live/index.html.heex:50 -#: lib/memex_web/live/note_live/show.html.heex:34 +#: lib/memex_web/live/note_live/show.html.heex:30 #: lib/memex_web/live/pipeline_live/index.html.heex:52 -#: lib/memex_web/live/pipeline_live/show.html.heex:34 -#: lib/memex_web/live/pipeline_live/show.html.heex:105 +#: lib/memex_web/live/pipeline_live/show.html.heex:30 +#: lib/memex_web/live/pipeline_live/show.html.heex:101 #, elixir-autogen, elixir-format msgid "delete" msgstr "" @@ -56,12 +56,12 @@ msgid "delete user" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:40 -#: lib/memex_web/live/context_live/show.html.heex:24 +#: lib/memex_web/live/context_live/show.html.heex:20 #: lib/memex_web/live/note_live/index.html.heex:40 -#: lib/memex_web/live/note_live/show.html.heex:24 +#: lib/memex_web/live/note_live/show.html.heex:20 #: lib/memex_web/live/pipeline_live/index.html.heex:40 -#: lib/memex_web/live/pipeline_live/show.html.heex:24 -#: lib/memex_web/live/pipeline_live/show.html.heex:94 +#: lib/memex_web/live/pipeline_live/show.html.heex:20 +#: lib/memex_web/live/pipeline_live/show.html.heex:90 #, elixir-autogen, elixir-format msgid "edit" msgstr "" @@ -112,7 +112,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:120 +#: lib/memex_web/live/pipeline_live/show.html.heex:116 #, elixir-autogen, elixir-format msgid "add step" msgstr "" @@ -145,24 +145,24 @@ msgid "copy invite link for %{invite_name}" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:48 -#: lib/memex_web/live/context_live/show.html.heex:32 +#: lib/memex_web/live/context_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{context_slug}" msgstr "" #: lib/memex_web/live/note_live/index.html.heex:48 -#: lib/memex_web/live/note_live/show.html.heex:32 +#: lib/memex_web/live/note_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{note_slug}" msgstr "" #: lib/memex_web/live/pipeline_live/index.html.heex:49 -#: lib/memex_web/live/pipeline_live/show.html.heex:32 +#: lib/memex_web/live/pipeline_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:103 +#: lib/memex_web/live/pipeline_live/show.html.heex:99 #, elixir-autogen, elixir-format msgid "delete %{step_title}" msgstr "" @@ -187,7 +187,7 @@ msgstr "" msgid "edit %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:92 +#: lib/memex_web/live/pipeline_live/show.html.heex:88 #, elixir-autogen, elixir-format msgid "edit %{step_title}" msgstr "" @@ -197,12 +197,12 @@ msgstr "" msgid "edit invite for %{invite_name}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:82 +#: lib/memex_web/live/pipeline_live/show.html.heex:78 #, elixir-autogen, elixir-format msgid "move %{step_title} down" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:66 +#: lib/memex_web/live/pipeline_live/show.html.heex:62 #, elixir-autogen, elixir-format msgid "move %{step_title} up" msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index 26927d7..7681758 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -422,7 +422,7 @@ msgstr "" msgid "what is this?" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:52 +#: lib/memex_web/live/pipeline_live/show.html.heex:48 #, elixir-autogen, elixir-format msgid "%{position}. %{title}" msgstr "" @@ -447,12 +447,12 @@ msgstr "" msgid "add step to %{slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:46 +#: lib/memex_web/live/pipeline_live/show.html.heex:42 #, elixir-autogen, elixir-format msgid "no steps" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:41 +#: lib/memex_web/live/pipeline_live/show.html.heex:37 #, elixir-autogen, elixir-format msgid "steps:" msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/errors.po b/priv/gettext/de/LC_MESSAGES/errors.po index 5de2c73..9ef6abf 100644 --- a/priv/gettext/de/LC_MESSAGES/errors.po +++ b/priv/gettext/de/LC_MESSAGES/errors.po @@ -47,11 +47,11 @@ msgid "must have the @ sign and no spaces" msgstr "" #: lib/memex/contexts/context.ex:58 -#: lib/memex/contexts/context.ex:71 +#: lib/memex/contexts/context.ex:72 #: lib/memex/notes/note.ex:57 -#: lib/memex/notes/note.ex:70 +#: lib/memex/notes/note.ex:71 #: lib/memex/pipelines/pipeline.ex:60 -#: lib/memex/pipelines/pipeline.ex:73 +#: lib/memex/pipelines/pipeline.ex:74 #, elixir-autogen, elixir-format msgid "invalid format: only numbers, letters and hyphen are accepted" msgstr "" @@ -140,9 +140,9 @@ msgstr "" msgid "user confirmation link is invalid or it has expired." msgstr "" -#: lib/memex/contexts/context.ex:84 -#: lib/memex/notes/note.ex:83 -#: lib/memex/pipelines/pipeline.ex:86 +#: lib/memex/contexts/context.ex:85 +#: lib/memex/notes/note.ex:84 +#: lib/memex/pipelines/pipeline.ex:87 #, elixir-autogen, elixir-format, fuzzy msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited" msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index 0a17903..916be6c 100644 --- a/priv/gettext/de/LC_MESSAGES/prompts.po +++ b/priv/gettext/de/LC_MESSAGES/prompts.po @@ -66,12 +66,12 @@ msgid "are you sure you want to make %{invite_name} unlimited?" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:47 -#: lib/memex_web/live/context_live/show.html.heex:31 +#: lib/memex_web/live/context_live/show.html.heex:27 #: lib/memex_web/live/note_live/index.html.heex:47 -#: lib/memex_web/live/note_live/show.html.heex:31 +#: lib/memex_web/live/note_live/show.html.heex:27 #: lib/memex_web/live/pipeline_live/index.html.heex:47 -#: lib/memex_web/live/pipeline_live/show.html.heex:31 -#: lib/memex_web/live/pipeline_live/show.html.heex:102 +#: lib/memex_web/live/pipeline_live/show.html.heex:27 +#: lib/memex_web/live/pipeline_live/show.html.heex:98 #, elixir-autogen, elixir-format msgid "are you sure?" msgstr "" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index e3be5a6..8d3da41 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -420,7 +420,7 @@ msgstr "" msgid "what is this?" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:52 +#: lib/memex_web/live/pipeline_live/show.html.heex:48 #, elixir-autogen, elixir-format msgid "%{position}. %{title}" msgstr "" @@ -445,12 +445,12 @@ msgstr "" msgid "add step to %{slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:46 +#: lib/memex_web/live/pipeline_live/show.html.heex:42 #, elixir-autogen, elixir-format msgid "no steps" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:41 +#: lib/memex_web/live/pipeline_live/show.html.heex:37 #, elixir-autogen, elixir-format msgid "steps:" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/actions.po b/priv/gettext/en/LC_MESSAGES/actions.po index 2383830..9bcea76 100644 --- a/priv/gettext/en/LC_MESSAGES/actions.po +++ b/priv/gettext/en/LC_MESSAGES/actions.po @@ -41,12 +41,12 @@ msgid "create invite" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:50 -#: lib/memex_web/live/context_live/show.html.heex:34 +#: lib/memex_web/live/context_live/show.html.heex:30 #: lib/memex_web/live/note_live/index.html.heex:50 -#: lib/memex_web/live/note_live/show.html.heex:34 +#: lib/memex_web/live/note_live/show.html.heex:30 #: lib/memex_web/live/pipeline_live/index.html.heex:52 -#: lib/memex_web/live/pipeline_live/show.html.heex:34 -#: lib/memex_web/live/pipeline_live/show.html.heex:105 +#: lib/memex_web/live/pipeline_live/show.html.heex:30 +#: lib/memex_web/live/pipeline_live/show.html.heex:101 #, elixir-autogen, elixir-format msgid "delete" msgstr "" @@ -57,12 +57,12 @@ msgid "delete user" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:40 -#: lib/memex_web/live/context_live/show.html.heex:24 +#: lib/memex_web/live/context_live/show.html.heex:20 #: lib/memex_web/live/note_live/index.html.heex:40 -#: lib/memex_web/live/note_live/show.html.heex:24 +#: lib/memex_web/live/note_live/show.html.heex:20 #: lib/memex_web/live/pipeline_live/index.html.heex:40 -#: lib/memex_web/live/pipeline_live/show.html.heex:24 -#: lib/memex_web/live/pipeline_live/show.html.heex:94 +#: lib/memex_web/live/pipeline_live/show.html.heex:20 +#: lib/memex_web/live/pipeline_live/show.html.heex:90 #, elixir-autogen, elixir-format msgid "edit" msgstr "" @@ -113,7 +113,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:120 +#: lib/memex_web/live/pipeline_live/show.html.heex:116 #, elixir-autogen, elixir-format msgid "add step" msgstr "" @@ -146,24 +146,24 @@ msgid "copy invite link for %{invite_name}" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:48 -#: lib/memex_web/live/context_live/show.html.heex:32 +#: lib/memex_web/live/context_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{context_slug}" msgstr "" #: lib/memex_web/live/note_live/index.html.heex:48 -#: lib/memex_web/live/note_live/show.html.heex:32 +#: lib/memex_web/live/note_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{note_slug}" msgstr "" #: lib/memex_web/live/pipeline_live/index.html.heex:49 -#: lib/memex_web/live/pipeline_live/show.html.heex:32 +#: lib/memex_web/live/pipeline_live/show.html.heex:28 #, elixir-autogen, elixir-format msgid "delete %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:103 +#: lib/memex_web/live/pipeline_live/show.html.heex:99 #, elixir-autogen, elixir-format msgid "delete %{step_title}" msgstr "" @@ -188,7 +188,7 @@ msgstr "" msgid "edit %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:92 +#: lib/memex_web/live/pipeline_live/show.html.heex:88 #, elixir-autogen, elixir-format msgid "edit %{step_title}" msgstr "" @@ -198,12 +198,12 @@ msgstr "" msgid "edit invite for %{invite_name}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:82 +#: lib/memex_web/live/pipeline_live/show.html.heex:78 #, elixir-autogen, elixir-format msgid "move %{step_title} down" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:66 +#: lib/memex_web/live/pipeline_live/show.html.heex:62 #, elixir-autogen, elixir-format msgid "move %{step_title} up" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 263ff97..fc644e9 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -421,7 +421,7 @@ msgstr "" msgid "what is this?" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:52 +#: lib/memex_web/live/pipeline_live/show.html.heex:48 #, elixir-autogen, elixir-format msgid "%{position}. %{title}" msgstr "" @@ -446,12 +446,12 @@ msgstr "" msgid "add step to %{slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:46 +#: lib/memex_web/live/pipeline_live/show.html.heex:42 #, elixir-autogen, elixir-format msgid "no steps" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:41 +#: lib/memex_web/live/pipeline_live/show.html.heex:37 #, elixir-autogen, elixir-format msgid "steps:" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/errors.po b/priv/gettext/en/LC_MESSAGES/errors.po index 2af46e8..6a5ba30 100644 --- a/priv/gettext/en/LC_MESSAGES/errors.po +++ b/priv/gettext/en/LC_MESSAGES/errors.po @@ -48,11 +48,11 @@ msgid "must have the @ sign and no spaces" msgstr "" #: lib/memex/contexts/context.ex:58 -#: lib/memex/contexts/context.ex:71 +#: lib/memex/contexts/context.ex:72 #: lib/memex/notes/note.ex:57 -#: lib/memex/notes/note.ex:70 +#: lib/memex/notes/note.ex:71 #: lib/memex/pipelines/pipeline.ex:60 -#: lib/memex/pipelines/pipeline.ex:73 +#: lib/memex/pipelines/pipeline.ex:74 #, elixir-autogen, elixir-format msgid "invalid format: only numbers, letters and hyphen are accepted" msgstr "" @@ -141,9 +141,9 @@ msgstr "" msgid "user confirmation link is invalid or it has expired." msgstr "" -#: lib/memex/contexts/context.ex:84 -#: lib/memex/notes/note.ex:83 -#: lib/memex/pipelines/pipeline.ex:86 +#: lib/memex/contexts/context.ex:85 +#: lib/memex/notes/note.ex:84 +#: lib/memex/pipelines/pipeline.ex:87 #, elixir-autogen, elixir-format, fuzzy msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited" msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index 1edc400..e62d9e0 100644 --- a/priv/gettext/en/LC_MESSAGES/prompts.po +++ b/priv/gettext/en/LC_MESSAGES/prompts.po @@ -67,12 +67,12 @@ msgid "are you sure you want to make %{invite_name} unlimited?" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:47 -#: lib/memex_web/live/context_live/show.html.heex:31 +#: lib/memex_web/live/context_live/show.html.heex:27 #: lib/memex_web/live/note_live/index.html.heex:47 -#: lib/memex_web/live/note_live/show.html.heex:31 +#: lib/memex_web/live/note_live/show.html.heex:27 #: lib/memex_web/live/pipeline_live/index.html.heex:47 -#: lib/memex_web/live/pipeline_live/show.html.heex:31 -#: lib/memex_web/live/pipeline_live/show.html.heex:102 +#: lib/memex_web/live/pipeline_live/show.html.heex:27 +#: lib/memex_web/live/pipeline_live/show.html.heex:98 #, elixir-autogen, elixir-format msgid "are you sure?" msgstr "" diff --git a/priv/gettext/errors.pot b/priv/gettext/errors.pot index 8c3099c..097821f 100644 --- a/priv/gettext/errors.pot +++ b/priv/gettext/errors.pot @@ -47,11 +47,11 @@ msgid "must have the @ sign and no spaces" msgstr "" #: lib/memex/contexts/context.ex:58 -#: lib/memex/contexts/context.ex:71 +#: lib/memex/contexts/context.ex:72 #: lib/memex/notes/note.ex:57 -#: lib/memex/notes/note.ex:70 +#: lib/memex/notes/note.ex:71 #: lib/memex/pipelines/pipeline.ex:60 -#: lib/memex/pipelines/pipeline.ex:73 +#: lib/memex/pipelines/pipeline.ex:74 #, elixir-autogen, elixir-format msgid "invalid format: only numbers, letters and hyphen are accepted" msgstr "" @@ -140,9 +140,9 @@ msgstr "" msgid "user confirmation link is invalid or it has expired." msgstr "" -#: lib/memex/contexts/context.ex:84 -#: lib/memex/notes/note.ex:83 -#: lib/memex/pipelines/pipeline.ex:86 +#: lib/memex/contexts/context.ex:85 +#: lib/memex/notes/note.ex:84 +#: lib/memex/pipelines/pipeline.ex:87 #, elixir-autogen, elixir-format msgid "invalid format: only numbers, letters and hyphen are accepted. tags must be comma or space delimited" msgstr "" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index bd10914..ac136e7 100644 --- a/priv/gettext/prompts.pot +++ b/priv/gettext/prompts.pot @@ -66,12 +66,12 @@ msgid "are you sure you want to make %{invite_name} unlimited?" msgstr "" #: lib/memex_web/live/context_live/index.html.heex:47 -#: lib/memex_web/live/context_live/show.html.heex:31 +#: lib/memex_web/live/context_live/show.html.heex:27 #: lib/memex_web/live/note_live/index.html.heex:47 -#: lib/memex_web/live/note_live/show.html.heex:31 +#: lib/memex_web/live/note_live/show.html.heex:27 #: lib/memex_web/live/pipeline_live/index.html.heex:47 -#: lib/memex_web/live/pipeline_live/show.html.heex:31 -#: lib/memex_web/live/pipeline_live/show.html.heex:102 +#: lib/memex_web/live/pipeline_live/show.html.heex:27 +#: lib/memex_web/live/pipeline_live/show.html.heex:98 #, elixir-autogen, elixir-format msgid "are you sure?" msgstr "" diff --git a/test/memex/contexts_test.exs b/test/memex/contexts_test.exs index 51f2305..b162a4a 100644 --- a/test/memex/contexts_test.exs +++ b/test/memex/contexts_test.exs @@ -25,10 +25,6 @@ defmodule Memex.ContextsTest do %{slug: "chickens", content: "bananas stuff", tags: ["life", "decisions"]} |> context_fixture(user) - _shouldnt_return = - %{slug: "dog", content: "banana treat stuff", visibility: :private} - |> context_fixture(user_fixture()) - # slug assert Contexts.list_contexts("dog", user) == [context_a] assert Contexts.list_contexts("dogs", user) == [context_a] @@ -72,15 +68,6 @@ defmodule Memex.ContextsTest do } |> context_fixture(user) - _shouldnt_return = - %{ - slug: "dog", - content: "treats bananas stuff", - tags: ["home", "life", "decisions"], - visibility: :private - } - |> context_fixture(user) - # slug assert Contexts.list_public_contexts("dog") == [context_a] assert Contexts.list_public_contexts("dogs") == [context_a] @@ -110,21 +97,6 @@ defmodule Memex.ContextsTest do assert Contexts.get_context!(context.id, user) == context end - test "get_context!/1 only returns unlisted or public contexts for other users", %{user: user} do - another_user = user_fixture() - context = context_fixture(%{visibility: :public}, another_user) - assert Contexts.get_context!(context.id, user) == context - - context = context_fixture(%{visibility: :unlisted}, another_user) - assert Contexts.get_context!(context.id, user) == context - - context = context_fixture(%{visibility: :private}, another_user) - - assert_raise Ecto.NoResultsError, fn -> - Contexts.get_context!(context.id, user) - end - end - test "get_context_by_slug/1 returns the context with given id", %{user: user} do context = context_fixture(%{slug: "a", visibility: :public}, user) assert Contexts.get_context_by_slug("a", user) == context @@ -136,20 +108,6 @@ defmodule Memex.ContextsTest do assert Contexts.get_context_by_slug("c", user) == context end - test "get_context_by_slug/1 only returns unlisted or public contexts for other users", %{ - user: user - } do - another_user = user_fixture() - context = context_fixture(%{slug: "a", visibility: :public}, another_user) - assert Contexts.get_context_by_slug("a", user) == context - - context = context_fixture(%{slug: "b", visibility: :unlisted}, another_user) - assert Contexts.get_context_by_slug("b", user) == context - - context_fixture(%{slug: "c", visibility: :private}, another_user) - assert Contexts.get_context_by_slug("c", user) |> is_nil() - end - test "create_context/1 with valid data creates a context", %{user: user} do valid_attrs = %{ content: "some content", diff --git a/test/memex/notes_test.exs b/test/memex/notes_test.exs index ebbc853..6caff2c 100644 --- a/test/memex/notes_test.exs +++ b/test/memex/notes_test.exs @@ -14,7 +14,6 @@ defmodule Memex.NotesTest do note_a = note_fixture(%{slug: "a", visibility: :public}, user) note_b = note_fixture(%{slug: "b", visibility: :unlisted}, user) note_c = note_fixture(%{slug: "c", visibility: :private}, user) - _shouldnt_return = note_fixture(%{visibility: :private}, user_fixture()) assert Notes.list_notes(user) == [note_a, note_b, note_c] end @@ -27,10 +26,6 @@ defmodule Memex.NotesTest do %{slug: "chickens", content: "bananas stuff", tags: ["life", "decisions"]} |> note_fixture(user) - _shouldnt_return = - %{slug: "dog", content: "banana treat stuff", visibility: :private} - |> note_fixture(user_fixture()) - # slug assert Notes.list_notes("dog", user) == [note_a] assert Notes.list_notes("dogs", user) == [note_a] @@ -74,15 +69,6 @@ defmodule Memex.NotesTest do } |> note_fixture(user) - _shouldnt_return = - %{ - slug: "dog", - content: "treats bananas stuff", - tags: ["home", "life", "decisions"], - visibility: :private - } - |> note_fixture(user) - # slug assert Notes.list_public_notes("dog") == [note_a] assert Notes.list_public_notes("dogs") == [note_a] @@ -112,21 +98,6 @@ defmodule Memex.NotesTest do assert Notes.get_note!(note.id, user) == note end - test "get_note!/1 only returns unlisted or public notes for other users", %{user: user} do - another_user = user_fixture() - note = note_fixture(%{visibility: :public}, another_user) - assert Notes.get_note!(note.id, user) == note - - note = note_fixture(%{visibility: :unlisted}, another_user) - assert Notes.get_note!(note.id, user) == note - - note = note_fixture(%{visibility: :private}, another_user) - - assert_raise Ecto.NoResultsError, fn -> - Notes.get_note!(note.id, user) - end - end - test "get_note_by_slug/1 returns the note with given id", %{user: user} do note = note_fixture(%{slug: "a", visibility: :public}, user) assert Notes.get_note_by_slug("a", user) == note @@ -138,20 +109,6 @@ defmodule Memex.NotesTest do assert Notes.get_note_by_slug("c", user) == note end - test "get_note_by_slug/1 only returns unlisted or public notes for other users", %{ - user: user - } do - another_user = user_fixture() - note = note_fixture(%{slug: "a", visibility: :public}, another_user) - assert Notes.get_note_by_slug("a", user) == note - - note = note_fixture(%{slug: "b", visibility: :unlisted}, another_user) - assert Notes.get_note_by_slug("b", user) == note - - note_fixture(%{slug: "c", visibility: :private}, another_user) - assert Notes.get_note_by_slug("c", user) |> is_nil() - end - test "create_note/1 with valid data creates a note", %{user: user} do valid_attrs = %{ content: "some content", diff --git a/test/memex/pipelines_test.exs b/test/memex/pipelines_test.exs index c121033..5b2269d 100644 --- a/test/memex/pipelines_test.exs +++ b/test/memex/pipelines_test.exs @@ -25,10 +25,6 @@ defmodule Memex.PipelinesTest do %{slug: "chickens", description: "bananas stuff", tags: ["life", "decisions"]} |> pipeline_fixture(user) - _shouldnt_return = - %{slug: "dog", description: "banana treat stuff", visibility: :private} - |> pipeline_fixture(user_fixture()) - # slug assert Pipelines.list_pipelines("dog", user) == [pipeline_a] assert Pipelines.list_pipelines("dogs", user) == [pipeline_a] @@ -72,15 +68,6 @@ defmodule Memex.PipelinesTest do } |> pipeline_fixture(user) - _shouldnt_return = - %{ - slug: "dog", - description: "treats bananas stuff", - tags: ["home", "life", "decisions"], - visibility: :private - } - |> pipeline_fixture(user) - # slug assert Pipelines.list_public_pipelines("dog") == [pipeline_a] assert Pipelines.list_public_pipelines("dogs") == [pipeline_a] @@ -110,23 +97,6 @@ defmodule Memex.PipelinesTest do assert Pipelines.get_pipeline!(pipeline.id, user) == pipeline end - test "get_pipeline!/1 only returns unlisted or public pipelines for other users", %{ - user: user - } do - another_user = user_fixture() - pipeline = pipeline_fixture(%{visibility: :public}, another_user) - assert Pipelines.get_pipeline!(pipeline.id, user) == pipeline - - pipeline = pipeline_fixture(%{visibility: :unlisted}, another_user) - assert Pipelines.get_pipeline!(pipeline.id, user) == pipeline - - pipeline = pipeline_fixture(%{visibility: :private}, another_user) - - assert_raise Ecto.NoResultsError, fn -> - Pipelines.get_pipeline!(pipeline.id, user) - end - end - test "get_pipeline_by_slug/1 returns the pipeline with given id", %{user: user} do pipeline = pipeline_fixture(%{slug: "a", visibility: :public}, user) assert Pipelines.get_pipeline_by_slug("a", user) == pipeline @@ -138,20 +108,6 @@ defmodule Memex.PipelinesTest do assert Pipelines.get_pipeline_by_slug("c", user) == pipeline end - test "get_pipeline_by_slug/1 only returns unlisted or public pipelines for other users", %{ - user: user - } do - another_user = user_fixture() - pipeline = pipeline_fixture(%{slug: "a", visibility: :public}, another_user) - assert Pipelines.get_pipeline_by_slug("a", user) == pipeline - - pipeline = pipeline_fixture(%{slug: "b", visibility: :unlisted}, another_user) - assert Pipelines.get_pipeline_by_slug("b", user) == pipeline - - pipeline_fixture(%{slug: "c", visibility: :private}, another_user) - assert Pipelines.get_pipeline_by_slug("c", user) |> is_nil() - end - test "create_pipeline/1 with valid data creates a pipeline", %{user: user} do valid_attrs = %{ description: "some description", diff --git a/test/memex/steps_test.exs b/test/memex/steps_test.exs index b6753a1..2df8390 100644 --- a/test/memex/steps_test.exs +++ b/test/memex/steps_test.exs @@ -25,16 +25,6 @@ defmodule Memex.StepsTest do assert Steps.get_step!(step.id, user) == step end - test "get_step!/2 only returns unlisted or public steps for other users", %{user: user} do - another_user = user_fixture() - another_pipeline = pipeline_fixture(another_user) - step = step_fixture(0, another_pipeline, another_user) - - assert_raise Ecto.NoResultsError, fn -> - Steps.get_step!(step.id, user) - end - end - test "create_step/4 with valid data creates a step", %{pipeline: pipeline, user: user} do valid_attrs = %{ content: "some content",