Merge branch 'release/1.1.3' into 'stable'

1.1.3 release

See merge request pleroma/pleroma!1884
This commit is contained in:
lain 2019-10-25 17:08:01 +00:00
commit a43b899e94
5 changed files with 59 additions and 42 deletions

View File

@ -3,6 +3,11 @@ 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/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [1.1.3] - 2019-10-25
### Fixed
- Blocked users showing up in notifications collapsed as if they were muted
- `pleroma_ctl` not working on Debian's default shell
## [1.1.2] - 2019-10-18 ## [1.1.2] - 2019-10-18
### Fixed ### Fixed
- `pleroma_ctl` trying to connect to a running instance when generating the config, which of course doesn't exist. - `pleroma_ctl` trying to connect to a running instance when generating the config, which of course doesn't exist.

View File

@ -34,7 +34,6 @@ defmodule Pleroma.Notification do
end end
def for_user_query(user, opts \\ []) do def for_user_query(user, opts \\ []) do
query =
Notification Notification
|> where(user_id: ^user.id) |> where(user_id: ^user.id)
|> where( |> where(
@ -54,22 +53,31 @@ defmodule Pleroma.Notification do
) )
) )
|> preload([n, a, o], activity: {a, object: o}) |> preload([n, a, o], activity: {a, object: o})
|> exclude_muted(user, opts)
|> exclude_blocked(user)
end
if opts[:with_muted] do defp exclude_blocked(query, user) do
query query
else
where(query, [n, a], a.actor not in ^user.info.muted_notifications)
|> where([n, a], a.actor not in ^user.info.blocks) |> where([n, a], a.actor not in ^user.info.blocks)
|> where( |> where(
[n, a], [n, a],
fragment("substring(? from '.*://([^/]*)')", a.actor) not in ^user.info.domain_blocks fragment("substring(? from '.*://([^/]*)')", a.actor) not in ^user.info.domain_blocks
) )
end
defp exclude_muted(query, _, %{with_muted: true}) do
query
end
defp exclude_muted(query, user, _opts) do
query
|> where([n, a], a.actor not in ^user.info.muted_notifications)
|> join(:left, [n, a], tm in Pleroma.ThreadMute, |> join(:left, [n, a], tm in Pleroma.ThreadMute,
on: tm.user_id == ^user.id and tm.context == fragment("?->>'context'", a.data) on: tm.user_id == ^user.id and tm.context == fragment("?->>'context'", a.data)
) )
|> where([n, a, o, tm], is_nil(tm.user_id)) |> where([n, a, o, tm], is_nil(tm.user_id))
end end
end
def for_user(user, opts \\ %{}) do def for_user(user, opts \\ %{}) do
user user

View File

@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
def project do def project do
[ [
app: :pleroma, app: :pleroma,
version: version("1.1.2"), version: version("1.1.3"),
elixir: "~> 1.7", elixir: "~> 1.7",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(), compilers: [:phoenix, :gettext] ++ Mix.compilers(),

View File

@ -140,12 +140,16 @@ else
FULL_ARGS="$*" FULL_ARGS="$*"
ACTION="$1" ACTION="$1"
if [ $# -gt 0 ]; then
shift shift
fi
echo "$1" | grep "^-" >/dev/null echo "$1" | grep "^-" >/dev/null
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
SUBACTION="$1" SUBACTION="$1"
if [ $# -gt 0 ]; then
shift shift
fi fi
fi
if [ "$ACTION" = "update" ]; then if [ "$ACTION" = "update" ]; then
update "$@" update "$@"

View File

@ -680,7 +680,7 @@ defmodule Pleroma.NotificationTest do
assert Notification.for_user(user) == [] assert Notification.for_user(user) == []
end end
test "it returns notifications for muted user with notifications and with_muted parameter" do test "it returns notifications from a muted user when with_muted is set" do
user = insert(:user) user = insert(:user)
muted = insert(:user) muted = insert(:user)
{:ok, user} = User.mute(user, muted) {:ok, user} = User.mute(user, muted)
@ -690,27 +690,27 @@ defmodule Pleroma.NotificationTest do
assert length(Notification.for_user(user, %{with_muted: true})) == 1 assert length(Notification.for_user(user, %{with_muted: true})) == 1
end end
test "it returns notifications for blocked user and with_muted parameter" do test "it doesn't return notifications from a blocked user when with_muted is set" do
user = insert(:user) user = insert(:user)
blocked = insert(:user) blocked = insert(:user)
{:ok, user} = User.block(user, blocked) {:ok, user} = User.block(user, blocked)
{:ok, _activity} = CommonAPI.post(blocked, %{"status" => "hey @#{user.nickname}"}) {:ok, _activity} = CommonAPI.post(blocked, %{"status" => "hey @#{user.nickname}"})
assert length(Notification.for_user(user, %{with_muted: true})) == 1 assert length(Notification.for_user(user, %{with_muted: true})) == 0
end end
test "it returns notificatitons for blocked domain and with_muted parameter" do test "it doesn't return notifications from a domain-blocked user when with_muted is set" do
user = insert(:user) user = insert(:user)
blocked = insert(:user, ap_id: "http://some-domain.com") blocked = insert(:user, ap_id: "http://some-domain.com")
{:ok, user} = User.block_domain(user, "some-domain.com") {:ok, user} = User.block_domain(user, "some-domain.com")
{:ok, _activity} = CommonAPI.post(blocked, %{"status" => "hey @#{user.nickname}"}) {:ok, _activity} = CommonAPI.post(blocked, %{"status" => "hey @#{user.nickname}"})
assert length(Notification.for_user(user, %{with_muted: true})) == 1 assert length(Notification.for_user(user, %{with_muted: true})) == 0
end end
test "it returns notifications for muted thread with_muted parameter" do test "it returns notifications from muted threads when with_muted is set" do
user = insert(:user) user = insert(:user)
another_user = insert(:user) another_user = insert(:user)