Merge branch 'release/1.1.4' into 'stable'
Release/1.1.4 - user.info fix plus NOT NULL for user.info See merge request pleroma/pleroma!1927
This commit is contained in:
commit
21716aa594
@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## [1.1.4] - 2019-11-01
|
||||
### Fixed
|
||||
- Added a migration that fills up empty user.info fields to prevent breakage after previous unsafe migrations.
|
||||
- Failure to migrate from pre-1.0.0 versions
|
||||
- Mastodon API: Notification stream not including follow notifications
|
||||
|
||||
## [1.1.3] - 2019-10-25
|
||||
### Fixed
|
||||
- Blocked users showing up in notifications collapsed as if they were muted
|
||||
|
@ -136,7 +136,7 @@ defmodule Pleroma.Web.Streamer.Worker do
|
||||
recipients = MapSet.new(item.recipients)
|
||||
domain_blocks = Pleroma.Web.ActivityPub.MRF.subdomains_regex(user.info.domain_blocks)
|
||||
|
||||
with parent when not is_nil(parent) <- Object.normalize(item),
|
||||
with parent <- Object.normalize(item) || item,
|
||||
true <- Enum.all?([blocks, mutes, reblog_mutes], &(item.actor not in &1)),
|
||||
true <- Enum.all?([blocks, mutes], &(parent.data["actor"] not in &1)),
|
||||
true <- MapSet.disjoint?(recipients, recipient_blocks),
|
||||
|
2
mix.exs
2
mix.exs
@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
|
||||
def project do
|
||||
[
|
||||
app: :pleroma,
|
||||
version: version("1.1.3"),
|
||||
version: version("1.1.4"),
|
||||
elixir: "~> 1.7",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||
|
@ -8,10 +8,10 @@ defmodule Pleroma.Repo.Migrations.MigrateOldBookmarks do
|
||||
|
||||
def up do
|
||||
query =
|
||||
from(u in User,
|
||||
from(u in "users",
|
||||
where: u.local == true,
|
||||
where: fragment("array_length(bookmarks, 1)") > 0,
|
||||
select: %{id: u.id, bookmarks: fragment("bookmarks")}
|
||||
where: fragment("array_length(?, 1)", u.bookmarks) > 0,
|
||||
select: %{id: u.id, bookmarks: u.bookmarks}
|
||||
)
|
||||
|
||||
Repo.stream(query)
|
||||
|
@ -0,0 +1,17 @@
|
||||
defmodule Pleroma.Repo.Migrations.FixAndSecureUserInfoField do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
execute("UPDATE users SET info = '{}'::jsonb WHERE info IS NULL")
|
||||
|
||||
execute("ALTER TABLE users
|
||||
ALTER COLUMN info SET NOT NULL
|
||||
")
|
||||
end
|
||||
|
||||
def down do
|
||||
execute("ALTER TABLE users
|
||||
ALTER COLUMN info DROP NOT NULL
|
||||
")
|
||||
end
|
||||
end
|
@ -3,6 +3,6 @@ defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
|
||||
alias Pleroma.User
|
||||
|
||||
def change do
|
||||
execute("update users set info = safe_jsonb_set(info, '{muted_notifications}', info->'mutes', true) where local = true")
|
||||
execute("update users set info = safe_jsonb_set(info, '{muted_notifications}', info->'mutes', true) where local = true and info->'mutes' is not null")
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,7 @@
|
||||
defmodule Pleroma.Repo.Migrations.FixNullMutedNotificationFields do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
execute("update users set info = safe_jsonb_set(info, '{muted_notifications}', '[]'::jsonb, true) where local = true and info->'muted_notifications' = 'null'::jsonb")
|
||||
end
|
||||
end
|
@ -10,7 +10,8 @@ defmodule Pleroma.Builders.UserBuilder do
|
||||
password_hash: Comeonin.Pbkdf2.hashpwsalt("test"),
|
||||
bio: "A tester.",
|
||||
ap_id: "some id",
|
||||
last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second)
|
||||
last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second),
|
||||
info: %{}
|
||||
}
|
||||
|
||||
Map.merge(user, data)
|
||||
|
@ -110,6 +110,24 @@ defmodule Pleroma.Web.StreamerTest do
|
||||
Streamer.stream("user:notification", notif)
|
||||
Task.await(task)
|
||||
end
|
||||
|
||||
test "it sends follow activities to the 'user:notification' stream", %{
|
||||
user: user
|
||||
} do
|
||||
user2 = insert(:user)
|
||||
task = Task.async(fn -> assert_receive {:text, _}, 4_000 end)
|
||||
|
||||
Streamer.add_socket(
|
||||
"user:notification",
|
||||
%{transport_pid: task.pid, assigns: %{user: user}}
|
||||
)
|
||||
|
||||
{:ok, _follower, _followed, _activity} = CommonAPI.follow(user2, user)
|
||||
|
||||
# We don't directly pipe the notification to the streamer as it's already
|
||||
# generated as a side effect of CommonAPI.follow().
|
||||
Task.await(task)
|
||||
end
|
||||
end
|
||||
|
||||
test "it sends to public" do
|
||||
|
Loading…
Reference in New Issue
Block a user