diff --git a/changelog.md b/changelog.md index 6d838ca..fa7ee27 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,5 @@ # v0.1.19 +- Add backlinks - Fix visibility issues with multiple users # v0.1.18 diff --git a/home.png b/home.png index 97aeb6c..6a59ee2 100644 Binary files a/home.png and b/home.png differ diff --git a/lib/memex/contexts.ex b/lib/memex/contexts.ex index 72255a9..9d9d566 100644 --- a/lib/memex/contexts.ex +++ b/lib/memex/contexts.ex @@ -88,6 +88,42 @@ defmodule Memex.Contexts do ) end + @doc """ + Returns the list of contexts that link to a particular slug. + + ## Examples + + iex> backlink(%User{id: 123}) + [%Context{}, ...] + + iex> backlink("[other-context]", %User{id: 123}) + [%Context{content: "[other-context]"}, ...] + + """ + @spec backlink(String.t(), User.t()) :: [Context.t()] + def backlink(link, %{id: user_id}) when user_id |> is_binary() do + link = link |> String.replace("[", "\\[") |> String.replace("]", "\\]") + link_regex = "(^|[^\[])#{link}($|[^\]])" + + Repo.all( + from c in Context, + where: fragment("? ~ ?", c.content, ^link_regex), + order_by: c.slug + ) + end + + def backlink(link, _invalid_user) do + link = link |> String.replace("[", "\\[") |> String.replace("]", "\\]") + link_regex = "(^|[^\[])#{link}($|[^\]])" + + Repo.all( + from c in Context, + where: fragment("? ~ ?", c.content, ^link_regex), + where: c.visibility == :public, + order_by: c.slug + ) + end + @doc """ Gets a single context. diff --git a/lib/memex/notes.ex b/lib/memex/notes.ex index c58ed68..9aabc2e 100644 --- a/lib/memex/notes.ex +++ b/lib/memex/notes.ex @@ -86,6 +86,42 @@ defmodule Memex.Notes do ) end + @doc """ + Returns the list of notes that link to a particular slug. + + ## Examples + + iex> backlink(%User{id: 123}) + [%Note{}, ...] + + iex> backlink("[other-note]", %User{id: 123}) + [%Note{content: "[other-note]"}, ...] + + """ + @spec backlink(String.t(), User.t()) :: [Note.t()] + def backlink(link, %{id: user_id}) when user_id |> is_binary() do + link = link |> String.replace("[", "\\[") |> String.replace("]", "\\]") + link_regex = "(^|[^\[])#{link}($|[^\]])" + + Repo.all( + from n in Note, + where: fragment("? ~ ?", n.content, ^link_regex), + order_by: n.slug + ) + end + + def backlink(link, _invalid_user) do + link = link |> String.replace("[", "\\[") |> String.replace("]", "\\]") + link_regex = "(^|[^\[])#{link}($|[^\]])" + + Repo.all( + from n in Note, + where: fragment("? ~ ?", n.content, ^link_regex), + where: n.visibility == :public, + order_by: n.slug + ) + end + @doc """ Gets a single note. diff --git a/lib/memex/pipelines.ex b/lib/memex/pipelines.ex index 922c70d..5c2217b 100644 --- a/lib/memex/pipelines.ex +++ b/lib/memex/pipelines.ex @@ -142,6 +142,50 @@ defmodule Memex.Pipelines do ) end + @doc """ + Returns the list of pipelines that link to a particular slug. + + ## Examples + + iex> backlink(%User{id: 123}) + [%Pipeline{}, ...] + + iex> backlink("[other-pipeline]", %User{id: 123}) + [%Pipeline{description: "[other-pipeline]"}, ...] + + """ + @spec backlink(String.t(), User.t()) :: [Pipeline.t()] + def backlink(link, %{id: user_id}) when user_id |> is_binary() do + link = link |> String.replace("[", "\\[") |> String.replace("]", "\\]") + link_regex = "(^|[^\[])#{link}($|[^\]])" + + Repo.all( + from p in Pipeline, + left_join: s in assoc(p, :steps), + where: + fragment("? ~ ?", p.description, ^link_regex) or + fragment("? ~ ?", s.content, ^link_regex), + distinct: true, + order_by: p.slug + ) + end + + def backlink(link, _invalid_user) do + link = link |> String.replace("[", "\\[") |> String.replace("]", "\\]") + link_regex = "(^|[^\[])#{link}($|[^\]])" + + Repo.all( + from p in Pipeline, + left_join: s in assoc(p, :steps), + where: + fragment("? ~ ?", p.description, ^link_regex) or + fragment("? ~ ?", s.content, ^link_regex), + where: p.visibility == :public, + distinct: true, + order_by: p.slug + ) + end + @doc """ Creates a pipeline. diff --git a/lib/memex_web/live/context_live/show.ex b/lib/memex_web/live/context_live/show.ex index 54ccf62..eb01763 100644 --- a/lib/memex_web/live/context_live/show.ex +++ b/lib/memex_web/live/context_live/show.ex @@ -1,6 +1,6 @@ defmodule MemexWeb.ContextLive.Show do use MemexWeb, :live_view - alias Memex.Contexts + alias Memex.{Contexts, Pipelines} @impl true def mount(_params, _session, socket) do @@ -23,7 +23,9 @@ defmodule MemexWeb.ContextLive.Show do socket |> assign( context: context, - page_title: page_title(live_action, context) + page_title: page_title(live_action, context), + context_backlinks: Contexts.backlink("[#{context.slug}]", current_user), + pipeline_backlinks: Pipelines.backlink("[[#{context.slug}]]", current_user) ) {:noreply, socket} diff --git a/lib/memex_web/live/context_live/show.html.heex b/lib/memex_web/live/context_live/show.html.heex index 7ec2130..e1203c7 100644 --- a/lib/memex_web/live/context_live/show.html.heex +++ b/lib/memex_web/live/context_live/show.html.heex @@ -11,6 +11,27 @@ <.context_content context={@context} /> +
<%= gettext("Backlinked by:") %>
+ <.link + :for={backlink <- @context_backlinks} + class="m-1 hover:underline" + patch={~p"/context/#{backlink}"} + > + <%= gettext("[%{slug}]", slug: backlink.slug) %> + + <.link + :for={backlink <- @pipeline_backlinks} + class="m-1 hover:underline" + patch={~p"/pipeline/#{backlink}"} + > + <%= gettext("[[%{slug}]]", slug: backlink.slug) %> + +<%= gettext("Visibility: %{visibility}", visibility: @context.visibility) %>
diff --git a/lib/memex_web/live/home_live.html.heex b/lib/memex_web/live/home_live.html.heex index f63b801..6e53575 100644 --- a/lib/memex_web/live/home_live.html.heex +++ b/lib/memex_web/live/home_live.html.heex @@ -1,5 +1,5 @@ -+ <%= gettext("view referencing items from the referenced item") %> +
+<%= gettext("Backlinked by:") %>
+ <.link + :for={backlink <- @note_backlinks} + class="m-1 hover:underline" + patch={~p"/note/#{backlink}"} + > + <%= gettext("[%{slug}]", slug: backlink.slug) %> + + <.link + :for={backlink <- @context_backlinks} + class="m-1 hover:underline" + patch={~p"/context/#{backlink}"} + > + <%= gettext("[[%{slug}]]", slug: backlink.slug) %> + + <.link + :for={backlink <- @pipeline_backlinks} + class="m-1 hover:underline" + patch={~p"/pipeline/#{backlink}"} + > + <%= gettext("[[[%{slug}]]]", slug: backlink.slug) %> + +<%= gettext("Visibility: %{visibility}", visibility: @note.visibility) %>
diff --git a/lib/memex_web/live/pipeline_live/show.ex b/lib/memex_web/live/pipeline_live/show.ex index 0b1e5a6..5b494ce 100644 --- a/lib/memex_web/live/pipeline_live/show.ex +++ b/lib/memex_web/live/pipeline_live/show.ex @@ -23,6 +23,7 @@ defmodule MemexWeb.PipelineLive.Show do socket |> assign( page_title: page_title(live_action, pipeline), + pipeline_backlinks: Pipelines.backlink("[#{pipeline.slug}]", current_user), pipeline: pipeline, steps: pipeline |> Steps.list_steps(current_user) ) diff --git a/lib/memex_web/live/pipeline_live/show.html.heex b/lib/memex_web/live/pipeline_live/show.html.heex index 4b77671..45c694f 100644 --- a/lib/memex_web/live/pipeline_live/show.html.heex +++ b/lib/memex_web/live/pipeline_live/show.html.heex @@ -11,6 +11,17 @@ <.pipeline_content pipeline={@pipeline} /> +<%= gettext("Backlinked by:") %>
+ <.link + :for={backlink <- @pipeline_backlinks} + class="m-1 hover:underline" + patch={~p"/pipeline/#{backlink}"} + > + <%= gettext("[%{slug}]", slug: backlink.slug) %> + +<%= gettext("Visibility: %{visibility}", visibility: @pipeline.visibility) %>
diff --git a/priv/gettext/actions.pot b/priv/gettext/actions.pot index 67e8b99..26d9acc 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:30 +#: lib/memex_web/live/context_live/show.html.heex:51 #: lib/memex_web/live/note_live/index.html.heex:50 -#: lib/memex_web/live/note_live/show.html.heex:30 +#: lib/memex_web/live/note_live/show.html.heex:58 #: lib/memex_web/live/pipeline_live/index.html.heex:52 -#: lib/memex_web/live/pipeline_live/show.html.heex:30 -#: lib/memex_web/live/pipeline_live/show.html.heex:101 +#: lib/memex_web/live/pipeline_live/show.html.heex:41 +#: lib/memex_web/live/pipeline_live/show.html.heex:112 #, 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:20 +#: lib/memex_web/live/context_live/show.html.heex:41 #: lib/memex_web/live/note_live/index.html.heex:40 -#: lib/memex_web/live/note_live/show.html.heex:20 +#: lib/memex_web/live/note_live/show.html.heex:48 #: lib/memex_web/live/pipeline_live/index.html.heex:40 -#: lib/memex_web/live/pipeline_live/show.html.heex:20 -#: lib/memex_web/live/pipeline_live/show.html.heex:90 +#: lib/memex_web/live/pipeline_live/show.html.heex:31 +#: lib/memex_web/live/pipeline_live/show.html.heex:101 #, elixir-autogen, elixir-format msgid "edit" msgstr "" @@ -112,7 +112,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:116 +#: lib/memex_web/live/pipeline_live/show.html.heex:127 #, 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:28 +#: lib/memex_web/live/context_live/show.html.heex:49 #, 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:28 +#: lib/memex_web/live/note_live/show.html.heex:56 #, 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:28 +#: lib/memex_web/live/pipeline_live/show.html.heex:39 #, elixir-autogen, elixir-format msgid "delete %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:99 +#: lib/memex_web/live/pipeline_live/show.html.heex:110 #, 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:88 +#: lib/memex_web/live/pipeline_live/show.html.heex:99 #, 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:78 +#: lib/memex_web/live/pipeline_live/show.html.heex:89 #, elixir-autogen, elixir-format msgid "move %{step_title} down" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:62 +#: lib/memex_web/live/pipeline_live/show.html.heex:73 #, 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 1f61e1f..6048d79 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:30 +#: lib/memex_web/live/context_live/show.html.heex:51 #: lib/memex_web/live/note_live/index.html.heex:50 -#: lib/memex_web/live/note_live/show.html.heex:30 +#: lib/memex_web/live/note_live/show.html.heex:58 #: lib/memex_web/live/pipeline_live/index.html.heex:52 -#: lib/memex_web/live/pipeline_live/show.html.heex:30 -#: lib/memex_web/live/pipeline_live/show.html.heex:101 +#: lib/memex_web/live/pipeline_live/show.html.heex:41 +#: lib/memex_web/live/pipeline_live/show.html.heex:112 #, 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:20 +#: lib/memex_web/live/context_live/show.html.heex:41 #: lib/memex_web/live/note_live/index.html.heex:40 -#: lib/memex_web/live/note_live/show.html.heex:20 +#: lib/memex_web/live/note_live/show.html.heex:48 #: lib/memex_web/live/pipeline_live/index.html.heex:40 -#: lib/memex_web/live/pipeline_live/show.html.heex:20 -#: lib/memex_web/live/pipeline_live/show.html.heex:90 +#: lib/memex_web/live/pipeline_live/show.html.heex:31 +#: lib/memex_web/live/pipeline_live/show.html.heex:101 #, elixir-autogen, elixir-format msgid "edit" msgstr "" @@ -112,7 +112,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:116 +#: lib/memex_web/live/pipeline_live/show.html.heex:127 #, 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:28 +#: lib/memex_web/live/context_live/show.html.heex:49 #, 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:28 +#: lib/memex_web/live/note_live/show.html.heex:56 #, 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:28 +#: lib/memex_web/live/pipeline_live/show.html.heex:39 #, elixir-autogen, elixir-format msgid "delete %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:99 +#: lib/memex_web/live/pipeline_live/show.html.heex:110 #, 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:88 +#: lib/memex_web/live/pipeline_live/show.html.heex:99 #, 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:78 +#: lib/memex_web/live/pipeline_live/show.html.heex:89 #, elixir-autogen, elixir-format msgid "move %{step_title} down" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:62 +#: lib/memex_web/live/pipeline_live/show.html.heex:73 #, 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 7681758..0d886b2 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -17,9 +17,9 @@ msgstr "" msgid "Reconnecting..." msgstr "" -#: lib/memex_web/live/context_live/show.html.heex:15 -#: lib/memex_web/live/note_live/show.html.heex:15 -#: lib/memex_web/live/pipeline_live/show.html.heex:15 +#: lib/memex_web/live/context_live/show.html.heex:36 +#: lib/memex_web/live/note_live/show.html.heex:43 +#: lib/memex_web/live/pipeline_live/show.html.heex:26 #, elixir-autogen, elixir-format msgid "Visibility: %{visibility}" msgstr "" @@ -29,7 +29,7 @@ msgstr "" msgid "accessible from any internet-capable device" msgstr "" -#: lib/memex_web/live/home_live.html.heex:85 +#: lib/memex_web/live/home_live.html.heex:94 #, elixir-autogen, elixir-format msgid "admins:" msgstr "" @@ -118,12 +118,12 @@ msgstr "" msgid "features" msgstr "" -#: lib/memex_web/live/home_live.html.heex:149 +#: lib/memex_web/live/home_live.html.heex:158 #, elixir-autogen, elixir-format msgid "help translate" msgstr "" -#: lib/memex_web/live/home_live.html.heex:80 +#: lib/memex_web/live/home_live.html.heex:89 #, elixir-autogen, elixir-format msgid "instance information" msgstr "" @@ -133,7 +133,7 @@ msgstr "" msgid "invite disabled" msgstr "" -#: lib/memex_web/live/home_live.html.heex:105 +#: lib/memex_web/live/home_live.html.heex:114 #, elixir-autogen, elixir-format msgid "invite only" msgstr "" @@ -217,7 +217,7 @@ msgstr "" msgid "provide context around a single topic and hotlink to your notes" msgstr "" -#: lib/memex_web/live/home_live.html.heex:104 +#: lib/memex_web/live/home_live.html.heex:113 #, elixir-autogen, elixir-format msgid "public signups" msgstr "" @@ -227,12 +227,12 @@ msgstr "" msgid "register" msgstr "" -#: lib/memex_web/live/home_live.html.heex:101 +#: lib/memex_web/live/home_live.html.heex:110 #, elixir-autogen, elixir-format msgid "registration:" msgstr "" -#: lib/memex_web/live/home_live.html.heex:160 +#: lib/memex_web/live/home_live.html.heex:169 #, elixir-autogen, elixir-format msgid "report bugs or request features" msgstr "" @@ -288,12 +288,12 @@ msgstr "" msgid "users" msgstr "" -#: lib/memex_web/live/home_live.html.heex:111 +#: lib/memex_web/live/home_live.html.heex:120 #, elixir-autogen, elixir-format msgid "version:" msgstr "" -#: lib/memex_web/live/home_live.html.heex:138 +#: lib/memex_web/live/home_live.html.heex:147 #, elixir-autogen, elixir-format msgid "view the source code" msgstr "" @@ -350,11 +350,11 @@ msgid "%{slug} created" msgstr "" #: lib/memex_web/live/context_live/index.ex:65 -#: lib/memex_web/live/context_live/show.ex:42 +#: lib/memex_web/live/context_live/show.ex:44 #: lib/memex_web/live/note_live/index.ex:65 -#: lib/memex_web/live/note_live/show.ex:42 +#: lib/memex_web/live/note_live/show.ex:45 #: lib/memex_web/live/pipeline_live/index.ex:65 -#: lib/memex_web/live/pipeline_live/show.ex:77 +#: lib/memex_web/live/pipeline_live/show.ex:78 #, elixir-autogen, elixir-format msgid "%{slug} deleted" msgstr "" @@ -367,11 +367,11 @@ msgid "%{slug} saved" msgstr "" #: lib/memex_web/live/context_live/index.ex:25 -#: lib/memex_web/live/context_live/show.ex:49 +#: lib/memex_web/live/context_live/show.ex:51 #: lib/memex_web/live/note_live/index.ex:25 -#: lib/memex_web/live/note_live/show.ex:49 +#: lib/memex_web/live/note_live/show.ex:52 #: lib/memex_web/live/pipeline_live/index.ex:24 -#: lib/memex_web/live/pipeline_live/show.ex:123 +#: lib/memex_web/live/pipeline_live/show.ex:124 #, elixir-autogen, elixir-format msgid "edit %{slug}" msgstr "" @@ -422,7 +422,7 @@ msgstr "" msgid "what is this?" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:48 +#: lib/memex_web/live/pipeline_live/show.html.heex:59 #, elixir-autogen, elixir-format msgid "%{position}. %{title}" msgstr "" @@ -432,7 +432,7 @@ msgstr "" msgid "%{title} created" msgstr "" -#: lib/memex_web/live/pipeline_live/show.ex:95 +#: lib/memex_web/live/pipeline_live/show.ex:96 #, elixir-autogen, elixir-format msgid "%{title} deleted" msgstr "" @@ -442,17 +442,17 @@ msgstr "" msgid "%{title} saved" msgstr "" -#: lib/memex_web/live/pipeline_live/show.ex:125 +#: lib/memex_web/live/pipeline_live/show.ex:126 #, elixir-autogen, elixir-format msgid "add step to %{slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:42 +#: lib/memex_web/live/pipeline_live/show.html.heex:53 #, elixir-autogen, elixir-format msgid "no steps" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:37 +#: lib/memex_web/live/pipeline_live/show.html.heex:48 #, elixir-autogen, elixir-format msgid "steps:" msgstr "" @@ -598,7 +598,7 @@ msgstr "" msgid "uses: %{uses_count}" msgstr "" -#: lib/memex_web/live/home_live.html.heex:128 +#: lib/memex_web/live/home_live.html.heex:137 #, elixir-autogen, elixir-format, fuzzy msgid "get involved" msgstr "" @@ -721,3 +721,38 @@ msgstr "" #, elixir-autogen, elixir-format msgid "(This note is empty)" msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:18 +#: lib/memex_web/live/note_live/show.html.heex:18 +#: lib/memex_web/live/pipeline_live/show.html.heex:15 +#, elixir-autogen, elixir-format +msgid "Backlinked by:" +msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:24 +#: lib/memex_web/live/note_live/show.html.heex:24 +#: lib/memex_web/live/pipeline_live/show.html.heex:21 +#, elixir-autogen, elixir-format, fuzzy +msgid "[%{slug}]" +msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:31 +#: lib/memex_web/live/note_live/show.html.heex:31 +#, elixir-autogen, elixir-format +msgid "[[%{slug}]]" +msgstr "" + +#: lib/memex_web/live/note_live/show.html.heex:38 +#, elixir-autogen, elixir-format +msgid "[[[%{slug}]]]" +msgstr "" + +#: lib/memex_web/live/home_live.html.heex:77 +#, elixir-autogen, elixir-format +msgid "backlinks:" +msgstr "" + +#: lib/memex_web/live/home_live.html.heex:80 +#, elixir-autogen, elixir-format +msgid "view referencing items from the referenced item" +msgstr "" diff --git a/priv/gettext/de/LC_MESSAGES/prompts.po b/priv/gettext/de/LC_MESSAGES/prompts.po index 916be6c..2f3166e 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:27 +#: lib/memex_web/live/context_live/show.html.heex:48 #: lib/memex_web/live/note_live/index.html.heex:47 -#: lib/memex_web/live/note_live/show.html.heex:27 +#: lib/memex_web/live/note_live/show.html.heex:55 #: lib/memex_web/live/pipeline_live/index.html.heex:47 -#: lib/memex_web/live/pipeline_live/show.html.heex:27 -#: lib/memex_web/live/pipeline_live/show.html.heex:98 +#: lib/memex_web/live/pipeline_live/show.html.heex:38 +#: lib/memex_web/live/pipeline_live/show.html.heex:109 #, elixir-autogen, elixir-format msgid "are you sure?" msgstr "" @@ -86,7 +86,7 @@ msgstr "" msgid "language updated successfully." msgstr "" -#: lib/memex_web/live/home_live.html.heex:90 +#: lib/memex_web/live/home_live.html.heex:99 #, elixir-autogen, elixir-format, fuzzy msgid "register to setup memEx" msgstr "" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index 8d3da41..49635f7 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -15,9 +15,9 @@ msgstr "" msgid "Reconnecting..." msgstr "" -#: lib/memex_web/live/context_live/show.html.heex:15 -#: lib/memex_web/live/note_live/show.html.heex:15 -#: lib/memex_web/live/pipeline_live/show.html.heex:15 +#: lib/memex_web/live/context_live/show.html.heex:36 +#: lib/memex_web/live/note_live/show.html.heex:43 +#: lib/memex_web/live/pipeline_live/show.html.heex:26 #, elixir-autogen, elixir-format msgid "Visibility: %{visibility}" msgstr "" @@ -27,7 +27,7 @@ msgstr "" msgid "accessible from any internet-capable device" msgstr "" -#: lib/memex_web/live/home_live.html.heex:85 +#: lib/memex_web/live/home_live.html.heex:94 #, elixir-autogen, elixir-format msgid "admins:" msgstr "" @@ -116,12 +116,12 @@ msgstr "" msgid "features" msgstr "" -#: lib/memex_web/live/home_live.html.heex:149 +#: lib/memex_web/live/home_live.html.heex:158 #, elixir-autogen, elixir-format msgid "help translate" msgstr "" -#: lib/memex_web/live/home_live.html.heex:80 +#: lib/memex_web/live/home_live.html.heex:89 #, elixir-autogen, elixir-format msgid "instance information" msgstr "" @@ -131,7 +131,7 @@ msgstr "" msgid "invite disabled" msgstr "" -#: lib/memex_web/live/home_live.html.heex:105 +#: lib/memex_web/live/home_live.html.heex:114 #, elixir-autogen, elixir-format msgid "invite only" msgstr "" @@ -215,7 +215,7 @@ msgstr "" msgid "provide context around a single topic and hotlink to your notes" msgstr "" -#: lib/memex_web/live/home_live.html.heex:104 +#: lib/memex_web/live/home_live.html.heex:113 #, elixir-autogen, elixir-format msgid "public signups" msgstr "" @@ -225,12 +225,12 @@ msgstr "" msgid "register" msgstr "" -#: lib/memex_web/live/home_live.html.heex:101 +#: lib/memex_web/live/home_live.html.heex:110 #, elixir-autogen, elixir-format msgid "registration:" msgstr "" -#: lib/memex_web/live/home_live.html.heex:160 +#: lib/memex_web/live/home_live.html.heex:169 #, elixir-autogen, elixir-format msgid "report bugs or request features" msgstr "" @@ -286,12 +286,12 @@ msgstr "" msgid "users" msgstr "" -#: lib/memex_web/live/home_live.html.heex:111 +#: lib/memex_web/live/home_live.html.heex:120 #, elixir-autogen, elixir-format msgid "version:" msgstr "" -#: lib/memex_web/live/home_live.html.heex:138 +#: lib/memex_web/live/home_live.html.heex:147 #, elixir-autogen, elixir-format msgid "view the source code" msgstr "" @@ -348,11 +348,11 @@ msgid "%{slug} created" msgstr "" #: lib/memex_web/live/context_live/index.ex:65 -#: lib/memex_web/live/context_live/show.ex:42 +#: lib/memex_web/live/context_live/show.ex:44 #: lib/memex_web/live/note_live/index.ex:65 -#: lib/memex_web/live/note_live/show.ex:42 +#: lib/memex_web/live/note_live/show.ex:45 #: lib/memex_web/live/pipeline_live/index.ex:65 -#: lib/memex_web/live/pipeline_live/show.ex:77 +#: lib/memex_web/live/pipeline_live/show.ex:78 #, elixir-autogen, elixir-format msgid "%{slug} deleted" msgstr "" @@ -365,11 +365,11 @@ msgid "%{slug} saved" msgstr "" #: lib/memex_web/live/context_live/index.ex:25 -#: lib/memex_web/live/context_live/show.ex:49 +#: lib/memex_web/live/context_live/show.ex:51 #: lib/memex_web/live/note_live/index.ex:25 -#: lib/memex_web/live/note_live/show.ex:49 +#: lib/memex_web/live/note_live/show.ex:52 #: lib/memex_web/live/pipeline_live/index.ex:24 -#: lib/memex_web/live/pipeline_live/show.ex:123 +#: lib/memex_web/live/pipeline_live/show.ex:124 #, elixir-autogen, elixir-format msgid "edit %{slug}" msgstr "" @@ -420,7 +420,7 @@ msgstr "" msgid "what is this?" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:48 +#: lib/memex_web/live/pipeline_live/show.html.heex:59 #, elixir-autogen, elixir-format msgid "%{position}. %{title}" msgstr "" @@ -430,7 +430,7 @@ msgstr "" msgid "%{title} created" msgstr "" -#: lib/memex_web/live/pipeline_live/show.ex:95 +#: lib/memex_web/live/pipeline_live/show.ex:96 #, elixir-autogen, elixir-format msgid "%{title} deleted" msgstr "" @@ -440,17 +440,17 @@ msgstr "" msgid "%{title} saved" msgstr "" -#: lib/memex_web/live/pipeline_live/show.ex:125 +#: lib/memex_web/live/pipeline_live/show.ex:126 #, elixir-autogen, elixir-format msgid "add step to %{slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:42 +#: lib/memex_web/live/pipeline_live/show.html.heex:53 #, elixir-autogen, elixir-format msgid "no steps" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:37 +#: lib/memex_web/live/pipeline_live/show.html.heex:48 #, elixir-autogen, elixir-format msgid "steps:" msgstr "" @@ -596,7 +596,7 @@ msgstr "" msgid "uses: %{uses_count}" msgstr "" -#: lib/memex_web/live/home_live.html.heex:128 +#: lib/memex_web/live/home_live.html.heex:137 #, elixir-autogen, elixir-format msgid "get involved" msgstr "" @@ -719,3 +719,38 @@ msgstr "" #, elixir-autogen, elixir-format msgid "(This note is empty)" msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:18 +#: lib/memex_web/live/note_live/show.html.heex:18 +#: lib/memex_web/live/pipeline_live/show.html.heex:15 +#, elixir-autogen, elixir-format +msgid "Backlinked by:" +msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:24 +#: lib/memex_web/live/note_live/show.html.heex:24 +#: lib/memex_web/live/pipeline_live/show.html.heex:21 +#, elixir-autogen, elixir-format +msgid "[%{slug}]" +msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:31 +#: lib/memex_web/live/note_live/show.html.heex:31 +#, elixir-autogen, elixir-format +msgid "[[%{slug}]]" +msgstr "" + +#: lib/memex_web/live/note_live/show.html.heex:38 +#, elixir-autogen, elixir-format +msgid "[[[%{slug}]]]" +msgstr "" + +#: lib/memex_web/live/home_live.html.heex:77 +#, elixir-autogen, elixir-format +msgid "backlinks:" +msgstr "" + +#: lib/memex_web/live/home_live.html.heex:80 +#, elixir-autogen, elixir-format +msgid "view referencing items from the referenced item" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/actions.po b/priv/gettext/en/LC_MESSAGES/actions.po index 9bcea76..135517e 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:30 +#: lib/memex_web/live/context_live/show.html.heex:51 #: lib/memex_web/live/note_live/index.html.heex:50 -#: lib/memex_web/live/note_live/show.html.heex:30 +#: lib/memex_web/live/note_live/show.html.heex:58 #: lib/memex_web/live/pipeline_live/index.html.heex:52 -#: lib/memex_web/live/pipeline_live/show.html.heex:30 -#: lib/memex_web/live/pipeline_live/show.html.heex:101 +#: lib/memex_web/live/pipeline_live/show.html.heex:41 +#: lib/memex_web/live/pipeline_live/show.html.heex:112 #, 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:20 +#: lib/memex_web/live/context_live/show.html.heex:41 #: lib/memex_web/live/note_live/index.html.heex:40 -#: lib/memex_web/live/note_live/show.html.heex:20 +#: lib/memex_web/live/note_live/show.html.heex:48 #: lib/memex_web/live/pipeline_live/index.html.heex:40 -#: lib/memex_web/live/pipeline_live/show.html.heex:20 -#: lib/memex_web/live/pipeline_live/show.html.heex:90 +#: lib/memex_web/live/pipeline_live/show.html.heex:31 +#: lib/memex_web/live/pipeline_live/show.html.heex:101 #, elixir-autogen, elixir-format msgid "edit" msgstr "" @@ -113,7 +113,7 @@ msgstr "" msgid "save" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:116 +#: lib/memex_web/live/pipeline_live/show.html.heex:127 #, 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:28 +#: lib/memex_web/live/context_live/show.html.heex:49 #, 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:28 +#: lib/memex_web/live/note_live/show.html.heex:56 #, 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:28 +#: lib/memex_web/live/pipeline_live/show.html.heex:39 #, elixir-autogen, elixir-format msgid "delete %{pipeline_slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:99 +#: lib/memex_web/live/pipeline_live/show.html.heex:110 #, 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:88 +#: lib/memex_web/live/pipeline_live/show.html.heex:99 #, 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:78 +#: lib/memex_web/live/pipeline_live/show.html.heex:89 #, elixir-autogen, elixir-format msgid "move %{step_title} down" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:62 +#: lib/memex_web/live/pipeline_live/show.html.heex:73 #, 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 fc644e9..47203f7 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -16,9 +16,9 @@ msgstr "" msgid "Reconnecting..." msgstr "" -#: lib/memex_web/live/context_live/show.html.heex:15 -#: lib/memex_web/live/note_live/show.html.heex:15 -#: lib/memex_web/live/pipeline_live/show.html.heex:15 +#: lib/memex_web/live/context_live/show.html.heex:36 +#: lib/memex_web/live/note_live/show.html.heex:43 +#: lib/memex_web/live/pipeline_live/show.html.heex:26 #, elixir-autogen, elixir-format msgid "Visibility: %{visibility}" msgstr "" @@ -28,7 +28,7 @@ msgstr "" msgid "accessible from any internet-capable device" msgstr "" -#: lib/memex_web/live/home_live.html.heex:85 +#: lib/memex_web/live/home_live.html.heex:94 #, elixir-autogen, elixir-format msgid "admins:" msgstr "" @@ -117,12 +117,12 @@ msgstr "" msgid "features" msgstr "" -#: lib/memex_web/live/home_live.html.heex:149 +#: lib/memex_web/live/home_live.html.heex:158 #, elixir-autogen, elixir-format msgid "help translate" msgstr "" -#: lib/memex_web/live/home_live.html.heex:80 +#: lib/memex_web/live/home_live.html.heex:89 #, elixir-autogen, elixir-format msgid "instance information" msgstr "" @@ -132,7 +132,7 @@ msgstr "" msgid "invite disabled" msgstr "" -#: lib/memex_web/live/home_live.html.heex:105 +#: lib/memex_web/live/home_live.html.heex:114 #, elixir-autogen, elixir-format msgid "invite only" msgstr "" @@ -216,7 +216,7 @@ msgstr "" msgid "provide context around a single topic and hotlink to your notes" msgstr "" -#: lib/memex_web/live/home_live.html.heex:104 +#: lib/memex_web/live/home_live.html.heex:113 #, elixir-autogen, elixir-format msgid "public signups" msgstr "" @@ -226,12 +226,12 @@ msgstr "" msgid "register" msgstr "" -#: lib/memex_web/live/home_live.html.heex:101 +#: lib/memex_web/live/home_live.html.heex:110 #, elixir-autogen, elixir-format msgid "registration:" msgstr "" -#: lib/memex_web/live/home_live.html.heex:160 +#: lib/memex_web/live/home_live.html.heex:169 #, elixir-autogen, elixir-format msgid "report bugs or request features" msgstr "" @@ -287,12 +287,12 @@ msgstr "" msgid "users" msgstr "" -#: lib/memex_web/live/home_live.html.heex:111 +#: lib/memex_web/live/home_live.html.heex:120 #, elixir-autogen, elixir-format msgid "version:" msgstr "" -#: lib/memex_web/live/home_live.html.heex:138 +#: lib/memex_web/live/home_live.html.heex:147 #, elixir-autogen, elixir-format msgid "view the source code" msgstr "" @@ -349,11 +349,11 @@ msgid "%{slug} created" msgstr "" #: lib/memex_web/live/context_live/index.ex:65 -#: lib/memex_web/live/context_live/show.ex:42 +#: lib/memex_web/live/context_live/show.ex:44 #: lib/memex_web/live/note_live/index.ex:65 -#: lib/memex_web/live/note_live/show.ex:42 +#: lib/memex_web/live/note_live/show.ex:45 #: lib/memex_web/live/pipeline_live/index.ex:65 -#: lib/memex_web/live/pipeline_live/show.ex:77 +#: lib/memex_web/live/pipeline_live/show.ex:78 #, elixir-autogen, elixir-format msgid "%{slug} deleted" msgstr "" @@ -366,11 +366,11 @@ msgid "%{slug} saved" msgstr "" #: lib/memex_web/live/context_live/index.ex:25 -#: lib/memex_web/live/context_live/show.ex:49 +#: lib/memex_web/live/context_live/show.ex:51 #: lib/memex_web/live/note_live/index.ex:25 -#: lib/memex_web/live/note_live/show.ex:49 +#: lib/memex_web/live/note_live/show.ex:52 #: lib/memex_web/live/pipeline_live/index.ex:24 -#: lib/memex_web/live/pipeline_live/show.ex:123 +#: lib/memex_web/live/pipeline_live/show.ex:124 #, elixir-autogen, elixir-format msgid "edit %{slug}" msgstr "" @@ -421,7 +421,7 @@ msgstr "" msgid "what is this?" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:48 +#: lib/memex_web/live/pipeline_live/show.html.heex:59 #, elixir-autogen, elixir-format msgid "%{position}. %{title}" msgstr "" @@ -431,7 +431,7 @@ msgstr "" msgid "%{title} created" msgstr "" -#: lib/memex_web/live/pipeline_live/show.ex:95 +#: lib/memex_web/live/pipeline_live/show.ex:96 #, elixir-autogen, elixir-format msgid "%{title} deleted" msgstr "" @@ -441,17 +441,17 @@ msgstr "" msgid "%{title} saved" msgstr "" -#: lib/memex_web/live/pipeline_live/show.ex:125 +#: lib/memex_web/live/pipeline_live/show.ex:126 #, elixir-autogen, elixir-format msgid "add step to %{slug}" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:42 +#: lib/memex_web/live/pipeline_live/show.html.heex:53 #, elixir-autogen, elixir-format msgid "no steps" msgstr "" -#: lib/memex_web/live/pipeline_live/show.html.heex:37 +#: lib/memex_web/live/pipeline_live/show.html.heex:48 #, elixir-autogen, elixir-format msgid "steps:" msgstr "" @@ -597,7 +597,7 @@ msgstr "" msgid "uses: %{uses_count}" msgstr "" -#: lib/memex_web/live/home_live.html.heex:128 +#: lib/memex_web/live/home_live.html.heex:137 #, elixir-autogen, elixir-format msgid "get involved" msgstr "" @@ -720,3 +720,38 @@ msgstr "" #, elixir-autogen, elixir-format msgid "(This note is empty)" msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:18 +#: lib/memex_web/live/note_live/show.html.heex:18 +#: lib/memex_web/live/pipeline_live/show.html.heex:15 +#, elixir-autogen, elixir-format +msgid "Backlinked by:" +msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:24 +#: lib/memex_web/live/note_live/show.html.heex:24 +#: lib/memex_web/live/pipeline_live/show.html.heex:21 +#, elixir-autogen, elixir-format, fuzzy +msgid "[%{slug}]" +msgstr "" + +#: lib/memex_web/live/context_live/show.html.heex:31 +#: lib/memex_web/live/note_live/show.html.heex:31 +#, elixir-autogen, elixir-format +msgid "[[%{slug}]]" +msgstr "" + +#: lib/memex_web/live/note_live/show.html.heex:38 +#, elixir-autogen, elixir-format +msgid "[[[%{slug}]]]" +msgstr "" + +#: lib/memex_web/live/home_live.html.heex:77 +#, elixir-autogen, elixir-format +msgid "backlinks:" +msgstr "" + +#: lib/memex_web/live/home_live.html.heex:80 +#, elixir-autogen, elixir-format +msgid "view referencing items from the referenced item" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/prompts.po b/priv/gettext/en/LC_MESSAGES/prompts.po index e62d9e0..70a6827 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:27 +#: lib/memex_web/live/context_live/show.html.heex:48 #: lib/memex_web/live/note_live/index.html.heex:47 -#: lib/memex_web/live/note_live/show.html.heex:27 +#: lib/memex_web/live/note_live/show.html.heex:55 #: lib/memex_web/live/pipeline_live/index.html.heex:47 -#: lib/memex_web/live/pipeline_live/show.html.heex:27 -#: lib/memex_web/live/pipeline_live/show.html.heex:98 +#: lib/memex_web/live/pipeline_live/show.html.heex:38 +#: lib/memex_web/live/pipeline_live/show.html.heex:109 #, elixir-autogen, elixir-format msgid "are you sure?" msgstr "" @@ -87,7 +87,7 @@ msgstr "" msgid "language updated successfully." msgstr "" -#: lib/memex_web/live/home_live.html.heex:90 +#: lib/memex_web/live/home_live.html.heex:99 #, elixir-autogen, elixir-format msgid "register to setup memEx" msgstr "" diff --git a/priv/gettext/prompts.pot b/priv/gettext/prompts.pot index ac136e7..5dd5535 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:27 +#: lib/memex_web/live/context_live/show.html.heex:48 #: lib/memex_web/live/note_live/index.html.heex:47 -#: lib/memex_web/live/note_live/show.html.heex:27 +#: lib/memex_web/live/note_live/show.html.heex:55 #: lib/memex_web/live/pipeline_live/index.html.heex:47 -#: lib/memex_web/live/pipeline_live/show.html.heex:27 -#: lib/memex_web/live/pipeline_live/show.html.heex:98 +#: lib/memex_web/live/pipeline_live/show.html.heex:38 +#: lib/memex_web/live/pipeline_live/show.html.heex:109 #, elixir-autogen, elixir-format msgid "are you sure?" msgstr "" @@ -86,7 +86,7 @@ msgstr "" msgid "language updated successfully." msgstr "" -#: lib/memex_web/live/home_live.html.heex:90 +#: lib/memex_web/live/home_live.html.heex:99 #, elixir-autogen, elixir-format msgid "register to setup memEx" msgstr "" diff --git a/readme.md b/readme.md index c32ba46..eeab075 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,8 @@ # memEx - + -memEx is an easy way to digitize the structured processes of your life. +A structured personal knowledge base, inspired by zettlekasten and org-mode. - Notes: Document notes about individual items or concepts - Contexts: Provide context around a single topic and hotlink to individual @@ -14,6 +14,7 @@ memEx is an easy way to digitize the structured processes of your life. - Multi-user: Built with sharing and collaboration in mind - Privacy: Privacy controls on a per-note, context or pipeline basis - Convenient: Accessible from any internet-capable device +- Backlinks: View referencing items from the referenced item # Installation diff --git a/test/memex/contexts_test.exs b/test/memex/contexts_test.exs index b162a4a..cb77d25 100644 --- a/test/memex/contexts_test.exs +++ b/test/memex/contexts_test.exs @@ -108,6 +108,25 @@ defmodule Memex.ContextsTest do assert Contexts.get_context_by_slug("c", user) == context end + test "backlink/2 returns contexts with backlinks", %{user: user} do + context_fixture(%{slug: "a", visibility: :public}, user) + assert Contexts.backlink("[a]", user) == [] + + context = context_fixture(%{slug: "b", content: "[a]", visibility: :unlisted}, user) + assert Contexts.backlink("[a]", user) == [context] + assert Contexts.backlink("[b]", user) == [] + end + + test "backlink/2 only returns public contexts for empty user", %{user: user} do + context_fixture(%{slug: "a", visibility: :public}, user) + context_fixture(%{slug: "b", content: "[a]", visibility: :unlisted}, user) + context_fixture(%{slug: "c", content: "[a]", visibility: :private}, user) + assert Contexts.backlink("[a]", nil) == [] + + context = context_fixture(%{slug: "d", content: "[a]", visibility: :public}, user) + assert Contexts.backlink("[a]", nil) == [context] + 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 6caff2c..784aeea 100644 --- a/test/memex/notes_test.exs +++ b/test/memex/notes_test.exs @@ -109,6 +109,25 @@ defmodule Memex.NotesTest do assert Notes.get_note_by_slug("c", user) == note end + test "backlink/2 returns notes with backlinks", %{user: user} do + note_fixture(%{slug: "a", visibility: :public}, user) + assert Notes.backlink("[a]", user) == [] + + note = note_fixture(%{slug: "b", content: "[a]", visibility: :unlisted}, user) + assert Notes.backlink("[a]", user) == [note] + assert Notes.backlink("[b]", user) == [] + end + + test "backlink/2 only returns public notes for empty user", %{user: user} do + note_fixture(%{slug: "a", visibility: :public}, user) + note_fixture(%{slug: "b", content: "[a]", visibility: :unlisted}, user) + note_fixture(%{slug: "c", content: "[a]", visibility: :private}, user) + assert Notes.backlink("[a]", nil) == [] + + note = note_fixture(%{slug: "d", content: "[a]", visibility: :public}, user) + assert Notes.backlink("[a]", nil) == [note] + 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 5b2269d..1526bbd 100644 --- a/test/memex/pipelines_test.exs +++ b/test/memex/pipelines_test.exs @@ -108,6 +108,25 @@ defmodule Memex.PipelinesTest do assert Pipelines.get_pipeline_by_slug("c", user) == pipeline end + test "backlink/2 returns pipelines with backlinks", %{user: user} do + pipeline_fixture(%{slug: "a", visibility: :public}, user) + assert Pipelines.backlink("[a]", user) == [] + + pipeline = pipeline_fixture(%{slug: "b", description: "[a]", visibility: :unlisted}, user) + assert Pipelines.backlink("[a]", user) == [pipeline] + assert Pipelines.backlink("[b]", user) == [] + end + + test "backlink/2 only returns public pipelines for empty user", %{user: user} do + pipeline_fixture(%{slug: "a", visibility: :public}, user) + pipeline_fixture(%{slug: "b", description: "[a]", visibility: :unlisted}, user) + pipeline_fixture(%{slug: "c", description: "[a]", visibility: :private}, user) + assert Pipelines.backlink("[a]", nil) == [] + + pipeline = pipeline_fixture(%{slug: "d", description: "[a]", visibility: :public}, user) + assert Pipelines.backlink("[a]", nil) == [pipeline] + end + test "create_pipeline/1 with valid data creates a pipeline", %{user: user} do valid_attrs = %{ description: "some description",