1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-11-16 06:16:15 +01:00

Merge remote-tracking branch 'upstream/develop' into neckbeard

This commit is contained in:
Your New SJW Waifu 2020-03-10 21:37:35 -05:00
commit 28dba91279
3 changed files with 6 additions and 5 deletions

View File

@ -18,9 +18,8 @@
6. Run `sudo -Hu postgres pg_restore -d <pleroma_db> -v -1 </path/to/backup_location/pleroma.pgdump>`
7. If you installed a newer Pleroma version, you should run `mix ecto.migrate`[^1]. This task performs database migrations, if there were any.
8. Restart the Pleroma service.
9. After you've restarted Pleroma, you will notice that postgres will take up more cpu resources than usual. A lot in fact. To fix this you must do a VACUUM ANLAYZE. This can also be done while the instance is still running like so:
$ sudo -u postgres psql pleroma_database_name
pleroma=# VACUUM ANALYZE;
9. Run `sudo -Hu postgres vacuumdb --all --analyze-in-stages`. This will quickly generate the statistics so that postgres can properly plan queries.
[^1]: Prefix with `MIX_ENV=prod` to run it using the production config file.
## Remove

View File

@ -591,7 +591,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
limit = Pleroma.Config.get([:instance, :limit])
length = String.length(full_payload)
if length < limit do
if length <= limit do
:ok
else
{:error, dgettext("errors", "The status is over the character limit")}

View File

@ -202,13 +202,15 @@ defmodule Pleroma.Web.CommonAPITest do
CommonAPI.post(user, %{"status" => ""})
end
test "it returns error when character limit is exceeded" do
test "it validates character limits are correctly enforced" do
Pleroma.Config.put([:instance, :limit], 5)
user = insert(:user)
assert {:error, "The status is over the character limit"} =
CommonAPI.post(user, %{"status" => "foobar"})
assert {:ok, activity} = CommonAPI.post(user, %{"status" => "12345"})
end
test "it can handle activities that expire" do