aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/clients.md7
-rw-r--r--lib/mix/pleroma.ex4
-rw-r--r--lib/mix/tasks/pleroma/ecto/ecto.ex11
-rw-r--r--lib/mix/tasks/pleroma/ecto/migrate.ex2
-rw-r--r--lib/mix/tasks/pleroma/ecto/rollback.ex2
-rw-r--r--lib/mix/tasks/pleroma/instance.ex16
-rw-r--r--lib/pleroma/notification.ex10
-rw-r--r--lib/pleroma/release_tasks.ex2
-rw-r--r--mix.exs2
-rw-r--r--priv/templates/sample_config.eex1
-rw-r--r--priv/templates/sample_psql.eex5
11 files changed, 49 insertions, 13 deletions
diff --git a/docs/clients.md b/docs/clients.md
index dc3e83bcc..30358c210 100644
--- a/docs/clients.md
+++ b/docs/clients.md
@@ -49,13 +49,6 @@ Feel free to contact us to be added to this list!
- Platforms: iOS, Android
- Features: No Streaming
-### Tootdon
-- Homepage: <http://tootdon.club/>, <http://blog.mastodon-tootdon.com/>
-- Source Code: ???
-- Contact: [@tootdon@mstdn.jp](https://mstdn.jp/users/tootdon)
-- Platforms: Android, iOS
-- Features: No Streaming
-
### Tusky
- Homepage: <https://tuskyapp.github.io/>
- Source Code: <https://github.com/tuskyapp/Tusky>
diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex
index 548c8a0a4..1b758ea33 100644
--- a/lib/mix/pleroma.ex
+++ b/lib/mix/pleroma.ex
@@ -9,6 +9,10 @@ defmodule Mix.Pleroma do
{:ok, _} = Application.ensure_all_started(:pleroma)
end
+ def load_pleroma do
+ Application.load(:pleroma)
+ end
+
def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do
Keyword.get(options, opt) || shell_prompt(prompt, defval, defname)
end
diff --git a/lib/mix/tasks/pleroma/ecto/ecto.ex b/lib/mix/tasks/pleroma/ecto/ecto.ex
index af09cb289..324f57fdd 100644
--- a/lib/mix/tasks/pleroma/ecto/ecto.ex
+++ b/lib/mix/tasks/pleroma/ecto/ecto.ex
@@ -9,6 +9,15 @@ defmodule Mix.Tasks.Pleroma.Ecto do
def ensure_migrations_path(repo, opts) do
path = opts[:migrations_path] || Path.join(source_repo_priv(repo), "migrations")
+ path =
+ case Path.type(path) do
+ :relative ->
+ Path.join(Application.app_dir(:pleroma), path)
+
+ :absolute ->
+ path
+ end
+
if not File.dir?(path) do
raise_missing_migrations(Path.relative_to_cwd(path), repo)
end
@@ -22,7 +31,7 @@ defmodule Mix.Tasks.Pleroma.Ecto do
def source_repo_priv(repo) do
config = repo.config()
priv = config[:priv] || "priv/#{repo |> Module.split() |> List.last() |> Macro.underscore()}"
- Path.join(File.cwd!(), priv)
+ Path.join(Application.app_dir(:pleroma), priv)
end
defp raise_missing_migrations(path, repo) do
diff --git a/lib/mix/tasks/pleroma/ecto/migrate.ex b/lib/mix/tasks/pleroma/ecto/migrate.ex
index 22eafe76f..855c977f6 100644
--- a/lib/mix/tasks/pleroma/ecto/migrate.ex
+++ b/lib/mix/tasks/pleroma/ecto/migrate.ex
@@ -4,6 +4,7 @@
defmodule Mix.Tasks.Pleroma.Ecto.Migrate do
use Mix.Task
+ import Mix.Pleroma
require Logger
@shortdoc "Wrapper on `ecto.migrate` task."
@@ -37,6 +38,7 @@ defmodule Mix.Tasks.Pleroma.Ecto.Migrate do
@impl true
def run(args \\ []) do
+ load_pleroma()
{opts, _} = OptionParser.parse!(args, strict: @switches, aliases: @aliases)
opts =
diff --git a/lib/mix/tasks/pleroma/ecto/rollback.ex b/lib/mix/tasks/pleroma/ecto/rollback.ex
index 0033ceba4..2ffb0901c 100644
--- a/lib/mix/tasks/pleroma/ecto/rollback.ex
+++ b/lib/mix/tasks/pleroma/ecto/rollback.ex
@@ -4,6 +4,7 @@
defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
use Mix.Task
+ import Mix.Pleroma
require Logger
@shortdoc "Wrapper on `ecto.rollback` task"
@@ -36,6 +37,7 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do
@impl true
def run(args \\ []) do
+ load_pleroma()
{opts, _} = OptionParser.parse!(args, strict: @switches, aliases: @aliases)
opts =
diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex
index c6738dbcc..997eabbeb 100644
--- a/lib/mix/tasks/pleroma/instance.ex
+++ b/lib/mix/tasks/pleroma/instance.ex
@@ -29,6 +29,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
- `--dbname DBNAME` - the name of the database to use
- `--dbuser DBUSER` - the user (aka role) to use for the database connection
- `--dbpass DBPASS` - the password to use for the database connection
+ - `--rum Y/N` - Whether to enable RUM indexes
- `--indexable Y/N` - Allow/disallow indexing site by search engines
- `--db-configurable Y/N` - Allow/disallow configuring instance from admin part
- `--uploads-dir` - the directory uploads go in when using a local uploader
@@ -51,6 +52,7 @@ defmodule Mix.Tasks.Pleroma.Instance do
dbname: :string,
dbuser: :string,
dbpass: :string,
+ rum: :string,
indexable: :string,
db_configurable: :string,
uploads_dir: :string,
@@ -136,6 +138,14 @@ defmodule Mix.Tasks.Pleroma.Instance do
"autogenerated"
)
+ rum_enabled =
+ get_option(
+ options,
+ :rum,
+ "Would you like to use RUM indices?",
+ "n"
+ ) === "y"
+
uploads_dir =
get_option(
options,
@@ -175,7 +185,8 @@ defmodule Mix.Tasks.Pleroma.Instance do
web_push_private_key: Base.url_encode64(web_push_private_key, padding: false),
db_configurable?: db_configurable?,
static_dir: static_dir,
- uploads_dir: uploads_dir
+ uploads_dir: uploads_dir,
+ rum_enabled: rum_enabled
)
result_psql =
@@ -183,7 +194,8 @@ defmodule Mix.Tasks.Pleroma.Instance do
template_dir <> "/sample_psql.eex",
dbname: dbname,
dbuser: dbuser,
- dbpass: dbpass
+ dbpass: dbpass,
+ rum_enabled: rum_enabled
)
shell_info(
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index e25692006..a414afbbf 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -127,8 +127,7 @@ defmodule Pleroma.Notification do
end
end
- def create_notifications(%Activity{data: %{"to" => _, "type" => type}} = activity)
- when type in ["Create", "Like", "Announce", "Follow"] do
+ def create_notifications(%Activity{data: %{"to" => _, "type" => "Create"}} = activity) do
object = Object.normalize(activity)
unless object && object.data["type"] == "Answer" do
@@ -140,6 +139,13 @@ defmodule Pleroma.Notification do
end
end
+ def create_notifications(%Activity{data: %{"to" => _, "type" => type}} = activity)
+ when type in ["Like", "Announce", "Follow"] do
+ users = get_notified_from_activity(activity)
+ notifications = Enum.map(users, fn user -> create_notification(activity, user) end)
+ {:ok, notifications}
+ end
+
def create_notifications(_), do: {:ok, []}
# TODO move to sql, too.
diff --git a/lib/pleroma/release_tasks.ex b/lib/pleroma/release_tasks.ex
index d6720cd05..8afabf463 100644
--- a/lib/pleroma/release_tasks.ex
+++ b/lib/pleroma/release_tasks.ex
@@ -44,6 +44,8 @@ defmodule Pleroma.ReleaseTasks do
end
def create do
+ Application.load(:pleroma)
+
case @repo.__adapter__.storage_up(@repo.config) do
:ok ->
IO.puts("The database for #{inspect(@repo)} has been created")
diff --git a/mix.exs b/mix.exs
index 0f57c4dae..5484c43ef 100644
--- a/mix.exs
+++ b/mix.exs
@@ -213,7 +213,7 @@ defmodule Pleroma.Mixfile do
true <- branch_name != "master" do
branch_name =
String.trim(branch_name)
- |> String.replace(~r/\W+/, "-")
+ |> String.replace(~r/[^0-9a-z\-\.]+/i, "-")
"-" <> branch_name
end
diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex
index 8cadb995e..2d4a49328 100644
--- a/priv/templates/sample_config.eex
+++ b/priv/templates/sample_config.eex
@@ -41,6 +41,7 @@ config :web_push_encryption, :vapid_details,
public_key: "<%= web_push_public_key %>",
private_key: "<%= web_push_private_key %>"
+config :pleroma, :database, rum_enabled: <%= rum_enabled %>
config :pleroma, :instance, static_dir: "<%= static_dir %>"
config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>"
diff --git a/priv/templates/sample_psql.eex b/priv/templates/sample_psql.eex
index f0ac05e57..627839a68 100644
--- a/priv/templates/sample_psql.eex
+++ b/priv/templates/sample_psql.eex
@@ -5,3 +5,8 @@ CREATE DATABASE <%= dbname %> OWNER <%= dbuser %>;
CREATE EXTENSION IF NOT EXISTS citext;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
+<%= if rum_enabled do
+ "CREATE EXTENSION IF NOT EXISTS rum;"
+else
+""
+end %>