Compare commits

..

No commits in common. "16c4ae16d3bd901a7f6094ded6d82c6b66a006b9" and "fe91d8de6d46e8f21fd91c0538f17b4834cce801" have entirely different histories.

30 changed files with 136 additions and 403 deletions

View File

@ -1,7 +0,0 @@
# v0.1.1
- improve search a whole lot
- improve table information for notes and contexts
- fix some typos
# v0.1.0
- initial release >:3c

View File

@ -77,14 +77,14 @@ Check them out!
For development, I recommend setting environment variables with For development, I recommend setting environment variables with
[direnv](https://direnv.net). [direnv](https://direnv.net).
By default, memEx will always bind to all external IPv4 and IPv6 addresses in By default, Memex will always bind to all external IPv4 and IPv6 addresses in
`dev` and `prod` mode, respectively. If you would like to use different values, `dev` and `prod` mode, respectively. If you would like to use different values,
they will need to be overridden in `config/dev.exs` and `config/runtime.exs` for they will need to be overridden in `config/dev.exs` and `config/runtime.exs` for
`dev` and `prod` modes, respectively. `dev` and `prod` modes, respectively.
## `MIX_ENV=dev` ## `MIX_ENV=dev`
In `dev` mode, memEx will listen for these environment variables at runtime. In `dev` mode, Memex will listen for these environment variables at runtime.
- `HOST`: External url to generate links with. Set this especially if you're - `HOST`: External url to generate links with. Set this especially if you're
behind a reverse proxy. Defaults to `localhost`. External URLs will always be behind a reverse proxy. Defaults to `localhost`. External URLs will always be
@ -100,7 +100,7 @@ In `dev` mode, memEx will listen for these environment variables at runtime.
## `MIX_ENV=test` ## `MIX_ENV=test`
In `test` mode (or in the Docker container), memEx will listen for the same environment variables as dev mode, but also include the following at runtime: In `test` mode (or in the Docker container), Memex will listen for the same environment variables as dev mode, but also include the following at runtime:
- `TEST_DATABASE_URL`: REPLACES `DATABASE_URL`. Controls the database url to - `TEST_DATABASE_URL`: REPLACES `DATABASE_URL`. Controls the database url to
connect to. Defaults to `ecto://postgres:postgres@localhost/memex_test`. connect to. Defaults to `ecto://postgres:postgres@localhost/memex_test`.
@ -110,7 +110,7 @@ In `test` mode (or in the Docker container), memEx will listen for the same envi
## `MIX_ENV=prod` ## `MIX_ENV=prod`
In `prod` mode (or in the Docker container), memEx will listen for the same environment variables as dev mode, but also include the following at runtime: In `prod` mode (or in the Docker container), Memex will listen for the same environment variables as dev mode, but also include the following at runtime:
- `SECRET_KEY_BASE`: Secret key base used to sign cookies. Must be generated - `SECRET_KEY_BASE`: Secret key base used to sign cookies. Must be generated
with `docker run -it shibaobun/memex mix phx.gen.secret` and set for server to start. with `docker run -it shibaobun/memex mix phx.gen.secret` and set for server to start.
@ -121,4 +121,4 @@ In `prod` mode (or in the Docker container), memEx will listen for the same envi
- `SMTP_SSL`: Set to `true` to enable SSL for emails. Defaults to `false`. - `SMTP_SSL`: Set to `true` to enable SSL for emails. Defaults to `false`.
- `EMAIL_FROM`: Sets the sender email in sent emails. Defaults to - `EMAIL_FROM`: Sets the sender email in sent emails. Defaults to
`no-reply@HOST` where `HOST` was previously defined. `no-reply@HOST` where `HOST` was previously defined.
- `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "memEx". - `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "Memex".

View File

@ -25,8 +25,8 @@ services:
# - SMTP_SSL=false # - SMTP_SSL=false
# optional, default is format below # optional, default is format below
# - EMAIL_FROM=no-reply@memex.example.tld # - EMAIL_FROM=no-reply@memex.example.tld
# optional, default is "memEx" # optional, default is "Memex"
# - EMAIL_NAME=memEx # - EMAIL_NAME=Memex
expose: expose:
- "4000" - "4000"
depends_on: depends_on:

View File

@ -35,13 +35,13 @@ defmodule Memex.Contexts do
where: c.user_id == ^user_id, where: c.user_id == ^user_id,
where: where:
fragment( fragment(
"search @@ websearch_to_tsquery('english', ?)", "search @@ to_tsquery(websearch_to_tsquery(?)::text || ':*')",
^trimmed_search ^trimmed_search
), ),
order_by: { order_by: {
:desc, :desc,
fragment( fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)", "ts_rank_cd(search, to_tsquery(websearch_to_tsquery(?)::text || ':*'), 4)",
^trimmed_search ^trimmed_search
) )
} }
@ -76,13 +76,13 @@ defmodule Memex.Contexts do
where: c.visibility == :public, where: c.visibility == :public,
where: where:
fragment( fragment(
"search @@ websearch_to_tsquery('english', ?)", "search @@ to_tsquery(websearch_to_tsquery(?)::text || ':*')",
^trimmed_search ^trimmed_search
), ),
order_by: { order_by: {
:desc, :desc,
fragment( fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)", "ts_rank_cd(search, to_tsquery(websearch_to_tsquery(?)::text || ':*'), 4)",
^trimmed_search ^trimmed_search
) )
} }

View File

@ -35,13 +35,13 @@ defmodule Memex.Notes do
where: n.user_id == ^user_id, where: n.user_id == ^user_id,
where: where:
fragment( fragment(
"search @@ websearch_to_tsquery('english', ?)", "search @@ to_tsquery(websearch_to_tsquery(?)::text || ':*')",
^trimmed_search ^trimmed_search
), ),
order_by: { order_by: {
:desc, :desc,
fragment( fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)", "ts_rank_cd(search, to_tsquery(websearch_to_tsquery(?)::text || ':*'), 4)",
^trimmed_search ^trimmed_search
) )
} }
@ -75,13 +75,13 @@ defmodule Memex.Notes do
where: n.visibility == :public, where: n.visibility == :public,
where: where:
fragment( fragment(
"search @@ websearch_to_tsquery('english', ?)", "search @@ to_tsquery(websearch_to_tsquery(?)::text || ':*')",
^trimmed_search ^trimmed_search
), ),
order_by: { order_by: {
:desc, :desc,
fragment( fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)", "ts_rank_cd(search, to_tsquery(websearch_to_tsquery(?)::text || ':*'), 4)",
^trimmed_search ^trimmed_search
) )
} }

View File

@ -35,13 +35,13 @@ defmodule Memex.Pipelines do
where: p.user_id == ^user_id, where: p.user_id == ^user_id,
where: where:
fragment( fragment(
"search @@ websearch_to_tsquery('english', ?)", "search @@ to_tsquery(websearch_to_tsquery(?)::text || ':*')",
^trimmed_search ^trimmed_search
), ),
order_by: { order_by: {
:desc, :desc,
fragment( fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)", "ts_rank_cd(search, to_tsquery(websearch_to_tsquery(?)::text || ':*'), 4)",
^trimmed_search ^trimmed_search
) )
} }
@ -75,13 +75,13 @@ defmodule Memex.Pipelines do
where: p.visibility == :public, where: p.visibility == :public,
where: where:
fragment( fragment(
"search @@ websearch_to_tsquery('english', ?)", "search @@ to_tsquery(websearch_to_tsquery(?)::text || ':*')",
^trimmed_search ^trimmed_search
), ),
order_by: { order_by: {
:desc, :desc,
fragment( fragment(
"ts_rank_cd(search, websearch_to_tsquery('english', ?), 4)", "ts_rank_cd(search, to_tsquery(websearch_to_tsquery(?)::text || ':*'), 4)",
^trimmed_search ^trimmed_search
) )
} }

View File

@ -4,7 +4,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
""" """
use MemexWeb, :live_component use MemexWeb, :live_component
alias Ecto.UUID alias Ecto.UUID
alias Memex.{Accounts.User, Contexts.Context} alias Memex.{Accounts.User, Contexts, Contexts.Context}
alias Phoenix.LiveView.{Rendered, Socket} alias Phoenix.LiveView.{Rendered, Socket}
@impl true @impl true
@ -45,6 +45,7 @@ defmodule MemexWeb.Components.ContextsTableComponent do
columns = [ columns = [
%{label: gettext("slug"), key: :slug}, %{label: gettext("slug"), key: :slug},
%{label: gettext("content"), key: :content},
%{label: gettext("tags"), key: :tags}, %{label: gettext("tags"), key: :tags},
%{label: gettext("visibility"), key: :visibility} %{label: gettext("visibility"), key: :visibility}
| columns | columns
@ -104,8 +105,20 @@ defmodule MemexWeb.Components.ContextsTableComponent do
{slug, slug_block} {slug, slug_block}
end end
defp get_value_for_key(:content, %{content: content}, _additional_data) do
assigns = %{content: content}
content_block = ~H"""
<div class="truncate max-w-sm">
<%= @content %>
</div>
"""
{content, content_block}
end
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
tags |> Enum.join(", ") tags |> Contexts.get_tags_string()
end end
defp get_value_for_key(:actions, context, %{actions: actions}) do defp get_value_for_key(:actions, context, %{actions: actions}) do

View File

@ -4,7 +4,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
""" """
use MemexWeb, :live_component use MemexWeb, :live_component
alias Ecto.UUID alias Ecto.UUID
alias Memex.{Accounts.User, Notes.Note} alias Memex.{Accounts.User, Notes, Notes.Note}
alias Phoenix.LiveView.{Rendered, Socket} alias Phoenix.LiveView.{Rendered, Socket}
@impl true @impl true
@ -45,6 +45,7 @@ defmodule MemexWeb.Components.NotesTableComponent do
columns = [ columns = [
%{label: gettext("slug"), key: :slug}, %{label: gettext("slug"), key: :slug},
%{label: gettext("content"), key: :content},
%{label: gettext("tags"), key: :tags}, %{label: gettext("tags"), key: :tags},
%{label: gettext("visibility"), key: :visibility} %{label: gettext("visibility"), key: :visibility}
| columns | columns
@ -104,8 +105,20 @@ defmodule MemexWeb.Components.NotesTableComponent do
{slug, slug_block} {slug, slug_block}
end end
defp get_value_for_key(:content, %{content: content}, _additional_data) do
assigns = %{content: content}
content_block = ~H"""
<div class="truncate max-w-sm">
<%= @content %>
</div>
"""
{content, content_block}
end
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
tags |> Enum.join(", ") tags |> Notes.get_tags_string()
end end
defp get_value_for_key(:actions, note, %{actions: actions}) do defp get_value_for_key(:actions, note, %{actions: actions}) do

View File

@ -4,7 +4,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
""" """
use MemexWeb, :live_component use MemexWeb, :live_component
alias Ecto.UUID alias Ecto.UUID
alias Memex.{Accounts.User, Pipelines.Pipeline} alias Memex.{Accounts.User, Pipelines, Pipelines.Pipeline}
alias Phoenix.LiveView.{Rendered, Socket} alias Phoenix.LiveView.{Rendered, Socket}
@impl true @impl true
@ -118,7 +118,7 @@ defmodule MemexWeb.Components.PipelinesTableComponent do
end end
defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do defp get_value_for_key(:tags, %{tags: tags}, _additional_data) do
tags |> Enum.join(", ") tags |> Pipelines.get_tags_string()
end end
defp get_value_for_key(:actions, pipeline, %{actions: actions}) do defp get_value_for_key(:actions, pipeline, %{actions: actions}) do

View File

@ -6,7 +6,7 @@
<br /> <br />
<span style="margin-bottom: 1em; font-size: 1.25em;"> <span style="margin-bottom: 1em; font-size: 1.25em;">
<%= dgettext("emails", "Welcome to memEx") %> <%= dgettext("emails", "Welcome to Memex") %>
</span> </span>
<br /> <br />
@ -19,5 +19,5 @@
<br /> <br />
<%= dgettext("emails", "If you didn't create an account at memEx, please ignore this.") %> <%= dgettext("emails", "If you didn't create an account at Memex, please ignore this.") %>
</div> </div>

View File

@ -1,7 +1,7 @@
<%= dgettext("emails", "Hi %{email},", email: @user.email) %> <%= dgettext("emails", "Hi %{email},", email: @user.email) %>
<%= dgettext("emails", "Welcome to memEx") %> <%= dgettext("emails", "Welcome to Memex") %>
<%= dgettext("emails", "You can confirm your account by visiting the URL below:") %> <%= dgettext("emails", "You can confirm your account by visiting the URL below:") %>

View File

@ -13,5 +13,5 @@
<br /> <br />
<%= dgettext("emails", "If you didn't request this change from memEx, please ignore this.") %> <%= dgettext("emails", "If you didn't request this change from Memex, please ignore this.") %>
</div> </div>

View File

@ -15,6 +15,6 @@
<%= dgettext( <%= dgettext(
"emails", "emails",
"If you didn't request this change from memEx, please ignore this." "If you didn't request this change from Memex, please ignore this."
) %> ) %>
</div> </div>

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title> <title>
<%= dgettext("errors", "Error") %>| memEx <%= dgettext("errors", "Error") %>| Memex
</title> </title>
<link rel="stylesheet" href="/css/app.css" /> <link rel="stylesheet" href="/css/app.css" />
<script defer type="text/javascript" src="/js/app.js"> <script defer type="text/javascript" src="/js/app.js">

View File

@ -1,12 +1,17 @@
defmodule MemexWeb.LayoutView do defmodule MemexWeb.LayoutView do
use MemexWeb, :view use MemexWeb, :view
import MemexWeb.{Components.Topbar, Gettext} import MemexWeb.Components.Topbar
alias MemexWeb.HomeLive alias MemexWeb.HomeLive
# Phoenix LiveDashboard is available only in development by default, # Phoenix LiveDashboard is available only in development by default,
# so we instruct Elixir to not warn if the dashboard route is missing. # so we instruct Elixir to not warn if the dashboard route is missing.
@compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}} @compile {:no_warn_undefined, {Routes, :live_dashboard_path, 2}}
def get_title(%{assigns: %{title: title}}), do: gettext("memEx | %{title}", title: title) def get_title(conn) do
def get_title(_conn), do: gettext("memEx") if conn.assigns |> Map.has_key?(:title) do
"Memex | #{conn.assigns.title}"
else
"Memex"
end
end
end end

View File

@ -4,7 +4,7 @@ defmodule Memex.MixProject do
def project do def project do
[ [
app: :memex, app: :memex,
version: "0.1.1", version: "0.1.0",
elixir: "~> 1.14", elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(), compilers: Mix.compilers(),

View File

@ -118,6 +118,8 @@ msgstr ""
msgid "confirm new password" msgid "confirm new password"
msgstr "" msgstr ""
#: lib/memex_web/components/contexts_table_component.ex:48
#: lib/memex_web/components/notes_table_component.ex:48
#: lib/memex_web/live/note_live/form_component.html.heex:23 #: lib/memex_web/live/note_live/form_component.html.heex:23
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "content" msgid "content"
@ -347,8 +349,8 @@ msgstr ""
msgid "tag1,tag2" msgid "tag1,tag2"
msgstr "" msgstr ""
#: lib/memex_web/components/contexts_table_component.ex:48 #: lib/memex_web/components/contexts_table_component.ex:49
#: lib/memex_web/components/notes_table_component.ex:48 #: lib/memex_web/components/notes_table_component.ex:49
#: lib/memex_web/components/pipelines_table_component.ex:49 #: lib/memex_web/components/pipelines_table_component.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "tags" msgid "tags"
@ -379,8 +381,8 @@ msgstr ""
msgid "view the source code" msgid "view the source code"
msgstr "" msgstr ""
#: lib/memex_web/components/contexts_table_component.ex:49 #: lib/memex_web/components/contexts_table_component.ex:50
#: lib/memex_web/components/notes_table_component.ex:49 #: lib/memex_web/components/notes_table_component.ex:50
#: lib/memex_web/components/pipelines_table_component.ex:50 #: lib/memex_web/components/pipelines_table_component.ex:50
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "visibility" msgid "visibility"
@ -495,7 +497,6 @@ msgstr ""
#: lib/memex_web/live/home_live.html.heex:3 #: lib/memex_web/live/home_live.html.heex:3
#: lib/memex_web/templates/layout/root.html.heex:8 #: lib/memex_web/templates/layout/root.html.heex:8
#: lib/memex_web/templates/layout/root.html.heex:9 #: lib/memex_web/templates/layout/root.html.heex:9
#: lib/memex_web/views/layout_view.ex:11
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "memEx" msgid "memEx"
msgstr "" msgstr ""
@ -644,8 +645,3 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "zettelkasten" msgid "zettelkasten"
msgstr "" msgstr ""
#: lib/memex_web/views/layout_view.ex:10
#, elixir-autogen, elixir-format
msgid "memEx | %{title}"
msgstr ""

View File

@ -31,22 +31,49 @@ msgstr ""
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:22
#, elixir-autogen, elixir-format
msgid "If you didn't create an account at Memex, please ignore this."
msgstr ""
#: lib/memex_web/templates/email/reset_password.txt.eex:8 #: lib/memex_web/templates/email/reset_password.txt.eex:8
#: lib/memex_web/templates/email/update_email.txt.eex:8 #: lib/memex_web/templates/email/update_email.txt.eex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{url}, please ignore this." msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/templates/email/reset_password.html.heex:16
#: lib/memex_web/templates/email/update_email.html.heex:16
#, elixir-autogen, elixir-format
msgid "If you didn't request this change from Memex, please ignore this."
msgstr ""
#: lib/memex/accounts/email.ex:37 #: lib/memex/accounts/email.ex:37
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Reset your Memex password" msgid "Reset your Memex password"
msgstr "" msgstr ""
#: lib/memex_web/templates/layout/email.txt.eex:9
#, elixir-autogen, elixir-format
msgid "This email was sent from Memex at %{url}, the self-hosted firearm tracker website."
msgstr ""
#: lib/memex_web/templates/layout/email.html.heex:13
#, elixir-autogen, elixir-format
msgid "This email was sent from Memex, the self-hosted firearm tracker website."
msgstr ""
#: lib/memex/accounts/email.ex:44 #: lib/memex/accounts/email.ex:44
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Update your Memex email" msgid "Update your Memex email"
msgstr "" msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:9
#: lib/memex_web/templates/email/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format
msgid "Welcome to Memex"
msgstr ""
#: lib/memex_web/templates/email/update_email.html.heex:8 #: lib/memex_web/templates/email/update_email.html.heex:8
#: lib/memex_web/templates/email/update_email.txt.eex:4 #: lib/memex_web/templates/email/update_email.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -64,30 +91,3 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can reset your password by visiting the URL below:" msgid "You can reset your password by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/templates/layout/email.html.heex:13
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx"
msgstr ""
#: lib/memex_web/templates/layout/email.txt.eex:9
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx at %{url}"
msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:22
#, elixir-autogen, elixir-format, fuzzy
msgid "If you didn't create an account at memEx, please ignore this."
msgstr ""
#: lib/memex_web/templates/email/reset_password.html.heex:16
#: lib/memex_web/templates/email/update_email.html.heex:16
#, elixir-autogen, elixir-format, fuzzy
msgid "If you didn't request this change from memEx, please ignore this."
msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:9
#: lib/memex_web/templates/email/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format, fuzzy
msgid "Welcome to memEx"
msgstr ""

View File

@ -107,6 +107,8 @@ msgstr ""
msgid "confirm new password" msgid "confirm new password"
msgstr "" msgstr ""
#: lib/memex_web/components/contexts_table_component.ex:48
#: lib/memex_web/components/notes_table_component.ex:48
#: lib/memex_web/live/note_live/form_component.html.heex:23 #: lib/memex_web/live/note_live/form_component.html.heex:23
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "content" msgid "content"
@ -336,8 +338,8 @@ msgstr ""
msgid "tag1,tag2" msgid "tag1,tag2"
msgstr "" msgstr ""
#: lib/memex_web/components/contexts_table_component.ex:48 #: lib/memex_web/components/contexts_table_component.ex:49
#: lib/memex_web/components/notes_table_component.ex:48 #: lib/memex_web/components/notes_table_component.ex:49
#: lib/memex_web/components/pipelines_table_component.ex:49 #: lib/memex_web/components/pipelines_table_component.ex:49
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "tags" msgid "tags"
@ -368,8 +370,8 @@ msgstr ""
msgid "view the source code" msgid "view the source code"
msgstr "" msgstr ""
#: lib/memex_web/components/contexts_table_component.ex:49 #: lib/memex_web/components/contexts_table_component.ex:50
#: lib/memex_web/components/notes_table_component.ex:49 #: lib/memex_web/components/notes_table_component.ex:50
#: lib/memex_web/components/pipelines_table_component.ex:50 #: lib/memex_web/components/pipelines_table_component.ex:50
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "visibility" msgid "visibility"
@ -484,7 +486,6 @@ msgstr ""
#: lib/memex_web/live/home_live.html.heex:3 #: lib/memex_web/live/home_live.html.heex:3
#: lib/memex_web/templates/layout/root.html.heex:8 #: lib/memex_web/templates/layout/root.html.heex:8
#: lib/memex_web/templates/layout/root.html.heex:9 #: lib/memex_web/templates/layout/root.html.heex:9
#: lib/memex_web/views/layout_view.ex:11
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "memEx" msgid "memEx"
msgstr "" msgstr ""
@ -633,8 +634,3 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "zettelkasten" msgid "zettelkasten"
msgstr "" msgstr ""
#: lib/memex_web/views/layout_view.ex:10
#, elixir-autogen, elixir-format
msgid "memEx | %{title}"
msgstr ""

View File

@ -30,12 +30,23 @@ msgstr ""
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:22
#, elixir-autogen, elixir-format
msgid "If you didn't create an account at Memex, please ignore this."
msgstr ""
#: lib/memex_web/templates/email/reset_password.txt.eex:8 #: lib/memex_web/templates/email/reset_password.txt.eex:8
#: lib/memex_web/templates/email/update_email.txt.eex:8 #: lib/memex_web/templates/email/update_email.txt.eex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{url}, please ignore this." msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/templates/email/reset_password.html.heex:16
#: lib/memex_web/templates/email/update_email.html.heex:16
#, elixir-autogen, elixir-format
msgid "If you didn't request this change from Memex, please ignore this."
msgstr ""
#: lib/memex/accounts/email.ex:37 #: lib/memex/accounts/email.ex:37
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Reset your Memex password" msgid "Reset your Memex password"
@ -46,6 +57,12 @@ msgstr ""
msgid "Update your Memex email" msgid "Update your Memex email"
msgstr "" msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:9
#: lib/memex_web/templates/email/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format
msgid "Welcome to Memex"
msgstr ""
#: lib/memex_web/templates/email/update_email.html.heex:8 #: lib/memex_web/templates/email/update_email.html.heex:8
#: lib/memex_web/templates/email/update_email.txt.eex:4 #: lib/memex_web/templates/email/update_email.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
@ -73,20 +90,3 @@ msgstr ""
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "This email was sent from memEx at %{url}" msgid "This email was sent from memEx at %{url}"
msgstr "" msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:22
#, elixir-autogen, elixir-format
msgid "If you didn't create an account at memEx, please ignore this."
msgstr ""
#: lib/memex_web/templates/email/reset_password.html.heex:16
#: lib/memex_web/templates/email/update_email.html.heex:16
#, elixir-autogen, elixir-format
msgid "If you didn't request this change from memEx, please ignore this."
msgstr ""
#: lib/memex_web/templates/email/confirm_email.html.heex:9
#: lib/memex_web/templates/email/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format
msgid "Welcome to memEx"
msgstr ""

View File

@ -1,56 +0,0 @@
defmodule Memex.Repo.Migrations.FixSearch do
use Ecto.Migration
def up do
reset_search_columns()
end
def down do
# no way to rollback this migration since the previous generated search columns were invalid
reset_search_columns()
end
defp reset_search_columns() do
alter table(:notes), do: remove(:search)
alter table(:contexts), do: remove(:search)
alter table(:pipelines), do: remove(:search)
flush()
execute """
ALTER TABLE notes
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce(slug, '')), 'A') ||
setweight(to_tsvector('english', coalesce(immutable_array_to_string(tags, ' '), '')), 'B') ||
setweight(to_tsvector('english', coalesce(content, '')), 'C')
) STORED
"""
execute("CREATE INDEX notes_trgm_idx ON notes USING GIN (search)")
execute """
ALTER TABLE contexts
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce(slug, '')), 'A') ||
setweight(to_tsvector('english', coalesce(immutable_array_to_string(tags, ' '), '')), 'B') ||
setweight(to_tsvector('english', coalesce(content, '')), 'C')
) STORED
"""
execute("CREATE INDEX contexts_trgm_idx ON contexts USING GIN (search)")
execute """
ALTER TABLE pipelines
ADD COLUMN search tsvector
GENERATED ALWAYS AS (
setweight(to_tsvector('english', coalesce(slug, '')), 'A') ||
setweight(to_tsvector('english', coalesce(immutable_array_to_string(tags, ' '), '')), 'B') ||
setweight(to_tsvector('english', coalesce(description, '')), 'C')
) STORED
"""
execute("CREATE INDEX pipelines_trgm_idx ON pipelines USING GIN (search)")
end
end

View File

@ -52,7 +52,7 @@ You can use the following environment variables to configure memEx in
- `SMTP_SSL`: Set to `true` to enable SSL for emails. Defaults to `false`. - `SMTP_SSL`: Set to `true` to enable SSL for emails. Defaults to `false`.
- `EMAIL_FROM`: Sets the sender email in sent emails. Defaults to - `EMAIL_FROM`: Sets the sender email in sent emails. Defaults to
`no-reply@HOST` where `HOST` was previously defined. `no-reply@HOST` where `HOST` was previously defined.
- `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "memEx". - `EMAIL_NAME`: Sets the sender name in sent emails. Defaults to "Memex".
--- ---

View File

@ -17,36 +17,6 @@ defmodule Memex.ContextsTest do
assert Contexts.list_contexts(user) == [context_a, context_b, context_c] assert Contexts.list_contexts(user) == [context_a, context_b, context_c]
end end
test "list_contexts/2 returns relevant contexts for a user", %{user: user} do
context_a = context_fixture(%{slug: "dogs", content: "has some treats in it"}, user)
context_b = context_fixture(%{slug: "cats", tags: ["home"]}, user)
context_c =
%{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]
assert Contexts.list_contexts("cat", user) == [context_b]
assert Contexts.list_contexts("chicken", user) == [context_c]
# content
assert Contexts.list_contexts("treat", user) == [context_a]
assert Contexts.list_contexts("banana", user) == [context_c]
assert Contexts.list_contexts("stuff", user) == [context_c]
# tag
assert Contexts.list_contexts("home", user) == [context_b]
assert Contexts.list_contexts("life", user) == [context_c]
assert Contexts.list_contexts("decision", user) == [context_c]
assert Contexts.list_contexts("decisions", user) == [context_c]
end
test "list_public_contexts/0 returns public contexts", %{user: user} do test "list_public_contexts/0 returns public contexts", %{user: user} do
public_context = context_fixture(%{visibility: :public}, user) public_context = context_fixture(%{visibility: :public}, user)
context_fixture(%{visibility: :unlisted}, user) context_fixture(%{visibility: :unlisted}, user)
@ -54,51 +24,6 @@ defmodule Memex.ContextsTest do
assert Contexts.list_public_contexts() == [public_context] assert Contexts.list_public_contexts() == [public_context]
end end
test "list_public_contexts/1 returns relevant contexts for a user", %{user: user} do
context_a =
%{slug: "dogs", content: "has some treats in it", visibility: :public}
|> context_fixture(user)
context_b =
%{slug: "cats", tags: ["home"], visibility: :public}
|> context_fixture(user)
context_c =
%{
slug: "chickens",
content: "bananas stuff",
tags: ["life", "decisions"],
visibility: :public
}
|> 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]
assert Contexts.list_public_contexts("cat") == [context_b]
assert Contexts.list_public_contexts("chicken") == [context_c]
# content
assert Contexts.list_public_contexts("treat") == [context_a]
assert Contexts.list_public_contexts("banana") == [context_c]
assert Contexts.list_public_contexts("stuff") == [context_c]
# tag
assert Contexts.list_public_contexts("home") == [context_b]
assert Contexts.list_public_contexts("life") == [context_c]
assert Contexts.list_public_contexts("decision") == [context_c]
assert Contexts.list_public_contexts("decisions") == [context_c]
end
test "get_context!/1 returns the context with given id", %{user: user} do test "get_context!/1 returns the context with given id", %{user: user} do
context = context_fixture(%{visibility: :public}, user) context = context_fixture(%{visibility: :public}, user)
assert Contexts.get_context!(context.id, user) == context assert Contexts.get_context!(context.id, user) == context

View File

@ -14,41 +14,9 @@ defmodule Memex.NotesTest do
note_a = note_fixture(%{slug: "a", visibility: :public}, user) note_a = note_fixture(%{slug: "a", visibility: :public}, user)
note_b = note_fixture(%{slug: "b", visibility: :unlisted}, user) note_b = note_fixture(%{slug: "b", visibility: :unlisted}, user)
note_c = note_fixture(%{slug: "c", visibility: :private}, 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] assert Notes.list_notes(user) == [note_a, note_b, note_c]
end end
test "list_notes/2 returns relevant notes for a user", %{user: user} do
note_a = note_fixture(%{slug: "dogs", content: "has some treats in it"}, user)
note_b = note_fixture(%{slug: "cats", tags: ["home"]}, user)
note_c =
%{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]
assert Notes.list_notes("cat", user) == [note_b]
assert Notes.list_notes("chicken", user) == [note_c]
# content
assert Notes.list_notes("treat", user) == [note_a]
assert Notes.list_notes("banana", user) == [note_c]
assert Notes.list_notes("stuff", user) == [note_c]
# tag
assert Notes.list_notes("home", user) == [note_b]
assert Notes.list_notes("life", user) == [note_c]
assert Notes.list_notes("decision", user) == [note_c]
assert Notes.list_notes("decisions", user) == [note_c]
end
test "list_public_notes/0 returns public notes", %{user: user} do test "list_public_notes/0 returns public notes", %{user: user} do
public_note = note_fixture(%{visibility: :public}, user) public_note = note_fixture(%{visibility: :public}, user)
note_fixture(%{visibility: :unlisted}, user) note_fixture(%{visibility: :unlisted}, user)
@ -56,51 +24,6 @@ defmodule Memex.NotesTest do
assert Notes.list_public_notes() == [public_note] assert Notes.list_public_notes() == [public_note]
end end
test "list_public_notes/1 returns relevant notes for a user", %{user: user} do
note_a =
%{slug: "dogs", content: "has some treats in it", visibility: :public}
|> note_fixture(user)
note_b =
%{slug: "cats", tags: ["home"], visibility: :public}
|> note_fixture(user)
note_c =
%{
slug: "chickens",
content: "bananas stuff",
tags: ["life", "decisions"],
visibility: :public
}
|> 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]
assert Notes.list_public_notes("cat") == [note_b]
assert Notes.list_public_notes("chicken") == [note_c]
# content
assert Notes.list_public_notes("treat") == [note_a]
assert Notes.list_public_notes("banana") == [note_c]
assert Notes.list_public_notes("stuff") == [note_c]
# tag
assert Notes.list_public_notes("home") == [note_b]
assert Notes.list_public_notes("life") == [note_c]
assert Notes.list_public_notes("decision") == [note_c]
assert Notes.list_public_notes("decisions") == [note_c]
end
test "get_note!/1 returns the note with given id", %{user: user} do test "get_note!/1 returns the note with given id", %{user: user} do
note = note_fixture(%{visibility: :public}, user) note = note_fixture(%{visibility: :public}, user)
assert Notes.get_note!(note.id, user) == note assert Notes.get_note!(note.id, user) == note

View File

@ -17,36 +17,6 @@ defmodule Memex.PipelinesTest do
assert Pipelines.list_pipelines(user) == [pipeline_a, pipeline_b, pipeline_c] assert Pipelines.list_pipelines(user) == [pipeline_a, pipeline_b, pipeline_c]
end end
test "list_pipelines/2 returns relevant pipelines for a user", %{user: user} do
pipeline_a = pipeline_fixture(%{slug: "dogs", description: "has some treats in it"}, user)
pipeline_b = pipeline_fixture(%{slug: "cats", tags: ["home"]}, user)
pipeline_c =
%{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]
assert Pipelines.list_pipelines("cat", user) == [pipeline_b]
assert Pipelines.list_pipelines("chicken", user) == [pipeline_c]
# description
assert Pipelines.list_pipelines("treat", user) == [pipeline_a]
assert Pipelines.list_pipelines("banana", user) == [pipeline_c]
assert Pipelines.list_pipelines("stuff", user) == [pipeline_c]
# tag
assert Pipelines.list_pipelines("home", user) == [pipeline_b]
assert Pipelines.list_pipelines("life", user) == [pipeline_c]
assert Pipelines.list_pipelines("decision", user) == [pipeline_c]
assert Pipelines.list_pipelines("decisions", user) == [pipeline_c]
end
test "list_public_pipelines/0 returns public pipelines", %{user: user} do test "list_public_pipelines/0 returns public pipelines", %{user: user} do
public_pipeline = pipeline_fixture(%{visibility: :public}, user) public_pipeline = pipeline_fixture(%{visibility: :public}, user)
pipeline_fixture(%{visibility: :unlisted}, user) pipeline_fixture(%{visibility: :unlisted}, user)
@ -54,51 +24,6 @@ defmodule Memex.PipelinesTest do
assert Pipelines.list_public_pipelines() == [public_pipeline] assert Pipelines.list_public_pipelines() == [public_pipeline]
end end
test "list_public_pipelines/1 returns relevant pipelines for a user", %{user: user} do
pipeline_a =
%{slug: "dogs", description: "has some treats in it", visibility: :public}
|> pipeline_fixture(user)
pipeline_b =
%{slug: "cats", tags: ["home"], visibility: :public}
|> pipeline_fixture(user)
pipeline_c =
%{
slug: "chickens",
description: "bananas stuff",
tags: ["life", "decisions"],
visibility: :public
}
|> 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]
assert Pipelines.list_public_pipelines("cat") == [pipeline_b]
assert Pipelines.list_public_pipelines("chicken") == [pipeline_c]
# description
assert Pipelines.list_public_pipelines("treat") == [pipeline_a]
assert Pipelines.list_public_pipelines("banana") == [pipeline_c]
assert Pipelines.list_public_pipelines("stuff") == [pipeline_c]
# tag
assert Pipelines.list_public_pipelines("home") == [pipeline_b]
assert Pipelines.list_public_pipelines("life") == [pipeline_c]
assert Pipelines.list_public_pipelines("decision") == [pipeline_c]
assert Pipelines.list_public_pipelines("decisions") == [pipeline_c]
end
test "get_pipeline!/1 returns the pipeline with given id", %{user: user} do test "get_pipeline!/1 returns the pipeline with given id", %{user: user} do
pipeline = pipeline_fixture(%{visibility: :public}, user) pipeline = pipeline_fixture(%{visibility: :public}, user)
assert Pipelines.get_pipeline!(pipeline.id, user) == pipeline assert Pipelines.get_pipeline!(pipeline.id, user) == pipeline

View File

@ -34,7 +34,7 @@ defmodule MemexWeb.ContextLiveTest do
{:ok, _index_live, html} = live(conn, Routes.context_index_path(conn, :index)) {:ok, _index_live, html} = live(conn, Routes.context_index_path(conn, :index))
assert html =~ "contexts" assert html =~ "contexts"
assert html =~ context.slug assert html =~ context.content
end end
test "saves new context", %{conn: conn} do test "saves new context", %{conn: conn} do
@ -56,7 +56,7 @@ defmodule MemexWeb.ContextLiveTest do
|> follow_redirect(conn, Routes.context_index_path(conn, :index)) |> follow_redirect(conn, Routes.context_index_path(conn, :index))
assert html =~ "#{@create_attrs |> Map.get("slug")} created" assert html =~ "#{@create_attrs |> Map.get("slug")} created"
assert html =~ "some-slug" assert html =~ "some content"
end end
test "updates context in listing", %{conn: conn, context: context} do test "updates context in listing", %{conn: conn, context: context} do
@ -78,7 +78,7 @@ defmodule MemexWeb.ContextLiveTest do
|> follow_redirect(conn, Routes.context_index_path(conn, :index)) |> follow_redirect(conn, Routes.context_index_path(conn, :index))
assert html =~ "#{@update_attrs |> Map.get("slug")} saved" assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
assert html =~ "some-updated-slug" assert html =~ "some updated content"
end end
test "deletes context in listing", %{conn: conn, context: context} do test "deletes context in listing", %{conn: conn, context: context} do
@ -96,7 +96,7 @@ defmodule MemexWeb.ContextLiveTest do
{:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug)) {:ok, _show_live, html} = live(conn, Routes.context_show_path(conn, :show, context.slug))
assert html =~ "context" assert html =~ "context"
assert html =~ context.slug assert html =~ context.content
end end
test "updates context within modal", %{conn: conn, context: context} do test "updates context within modal", %{conn: conn, context: context} do
@ -117,7 +117,7 @@ defmodule MemexWeb.ContextLiveTest do
|> follow_redirect(conn, Routes.context_show_path(conn, :show, context.slug)) |> follow_redirect(conn, Routes.context_show_path(conn, :show, context.slug))
assert html =~ "#{context.slug} saved" assert html =~ "#{context.slug} saved"
assert html =~ "tag2" assert html =~ "some updated content"
end end
test "deletes context", %{conn: conn, context: context} do test "deletes context", %{conn: conn, context: context} do

View File

@ -34,7 +34,7 @@ defmodule MemexWeb.NoteLiveTest do
{:ok, _index_live, html} = live(conn, Routes.note_index_path(conn, :index)) {:ok, _index_live, html} = live(conn, Routes.note_index_path(conn, :index))
assert html =~ "notes" assert html =~ "notes"
assert html =~ note.slug assert html =~ note.content
end end
test "saves new note", %{conn: conn} do test "saves new note", %{conn: conn} do
@ -56,7 +56,7 @@ defmodule MemexWeb.NoteLiveTest do
|> follow_redirect(conn, Routes.note_index_path(conn, :index)) |> follow_redirect(conn, Routes.note_index_path(conn, :index))
assert html =~ "#{@create_attrs |> Map.get("slug")} created" assert html =~ "#{@create_attrs |> Map.get("slug")} created"
assert html =~ "some-slug" assert html =~ "some content"
end end
test "updates note in listing", %{conn: conn, note: note} do test "updates note in listing", %{conn: conn, note: note} do
@ -78,7 +78,7 @@ defmodule MemexWeb.NoteLiveTest do
|> follow_redirect(conn, Routes.note_index_path(conn, :index)) |> follow_redirect(conn, Routes.note_index_path(conn, :index))
assert html =~ "#{@update_attrs |> Map.get("slug")} saved" assert html =~ "#{@update_attrs |> Map.get("slug")} saved"
assert html =~ "some-updated-slug" assert html =~ "some updated content"
end end
test "deletes note in listing", %{conn: conn, note: note} do test "deletes note in listing", %{conn: conn, note: note} do
@ -96,7 +96,7 @@ defmodule MemexWeb.NoteLiveTest do
{:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug)) {:ok, _show_live, html} = live(conn, Routes.note_show_path(conn, :show, note.slug))
assert html =~ "note" assert html =~ "note"
assert html =~ note.slug assert html =~ note.content
end end
test "updates note within modal", %{conn: conn, note: note} do test "updates note within modal", %{conn: conn, note: note} do
@ -117,7 +117,7 @@ defmodule MemexWeb.NoteLiveTest do
|> follow_redirect(conn, Routes.note_show_path(conn, :show, note.slug)) |> follow_redirect(conn, Routes.note_show_path(conn, :show, note.slug))
assert html =~ "#{note.slug} saved" assert html =~ "#{note.slug} saved"
assert html =~ "tag2" assert html =~ "some updated content"
end end
test "deletes note", %{conn: conn, note: note} do test "deletes note", %{conn: conn, note: note} do

View File

@ -16,7 +16,7 @@ defmodule Memex.ContextsFixtures do
attrs attrs
|> Enum.into(%{ |> Enum.into(%{
content: "some content", content: "some content",
tags: [], tag: [],
slug: random_slug(), slug: random_slug(),
visibility: :private visibility: :private
}) })

View File

@ -16,7 +16,7 @@ defmodule Memex.NotesFixtures do
attrs attrs
|> Enum.into(%{ |> Enum.into(%{
content: "some content", content: "some content",
tags: [], tag: [],
slug: random_slug(), slug: random_slug(),
visibility: :private visibility: :private
}) })

View File

@ -16,7 +16,7 @@ defmodule Memex.PipelinesFixtures do
attrs attrs
|> Enum.into(%{ |> Enum.into(%{
description: "some description", description: "some description",
tags: [], tag: [],
slug: random_slug(), slug: random_slug(),
visibility: :private visibility: :private
}) })