Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
a1batross
pleroma
Commits
a43b899e
Commit
a43b899e
authored
Oct 25, 2019
by
lain
Browse files
Merge branch 'release/1.1.3' into 'stable'
1.1.3 release See merge request
pleroma/pleroma!1884
parents
9b26d160
948d0d3b
Changes
5
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
a43b899e
...
...
@@ -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/
)
.
## [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
### Fixed
-
`pleroma_ctl`
trying to connect to a running instance when generating the config, which of course doesn't exist.
...
...
lib/pleroma/notification.ex
View file @
a43b899e
...
...
@@ -34,41 +34,49 @@ defmodule Pleroma.Notification do
end
def
for_user_query
(
user
,
opts
\\
[])
do
query
=
Notification
|>
where
(
user_id:
^
user
.
id
)
|>
where
(
[
n
,
a
],
Notification
|>
where
(
user_id:
^
user
.
id
)
|>
where
(
[
n
,
a
],
fragment
(
"? not in (SELECT ap_id FROM users WHERE info->'deactivated' @> 'true')"
,
a
.
actor
)
)
|>
join
(
:inner
,
[
n
],
activity
in
assoc
(
n
,
:activity
))
|>
join
(
:left
,
[
n
,
a
],
object
in
Object
,
on:
fragment
(
"? not in (SELECT ap_id FROM users WHERE info->'deactivated' @> 'true')"
,
a
.
actor
"(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)"
,
object
.
data
,
a
.
data
)
)
|>
join
(
:inner
,
[
n
],
activity
in
assoc
(
n
,
:activity
))
|>
join
(
:left
,
[
n
,
a
],
object
in
Object
,
on:
fragment
(
"(?->>'id') = COALESCE((? -> 'object'::text) ->> 'id'::text)"
,
object
.
data
,
a
.
data
)
)
|>
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
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
],
fragment
(
"substring(? from '.*://([^/]*)')"
,
a
.
actor
)
not
in
^
user
.
info
.
domain_blocks
)
|>
join
(
:left
,
[
n
,
a
],
tm
in
Pleroma
.
ThreadMute
,
on:
tm
.
user_id
==
^
user
.
id
and
tm
.
context
==
fragment
(
"?->>'context'"
,
a
.
data
)
)
|>
where
([
n
,
a
,
o
,
tm
],
is_nil
(
tm
.
user_id
))
end
defp
exclude_blocked
(
query
,
user
)
do
query
|>
where
([
n
,
a
],
a
.
actor
not
in
^
user
.
info
.
blocks
)
|>
where
(
[
n
,
a
],
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
,
on:
tm
.
user_id
==
^
user
.
id
and
tm
.
context
==
fragment
(
"?->>'context'"
,
a
.
data
)
)
|>
where
([
n
,
a
,
o
,
tm
],
is_nil
(
tm
.
user_id
))
end
def
for_user
(
user
,
opts
\\
%{})
do
...
...
mix.exs
View file @
a43b899e
...
...
@@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
def
project
do
[
app:
:pleroma
,
version:
version
(
"1.1.
2
"
),
version:
version
(
"1.1.
3
"
),
elixir:
"~> 1.7"
,
elixirc_paths:
elixirc_paths
(
Mix
.
env
()),
compilers:
[
:phoenix
,
:gettext
]
++
Mix
.
compilers
(),
...
...
rel/files/bin/pleroma_ctl
View file @
a43b899e
...
...
@@ -140,11 +140,15 @@ else
FULL_ARGS
=
"
$*
"
ACTION
=
"
$1
"
shift
echo
"
$1
"
|
grep
"^-"
>
/dev/null
if
[
$#
-gt
0
]
;
then
shift
fi
echo
"
$1
"
|
grep
"^-"
>
/dev/null
if
[
$?
-eq
1
]
;
then
SUBACTION
=
"
$1
"
shift
if
[
$#
-gt
0
]
;
then
shift
fi
fi
if
[
"
$ACTION
"
=
"update"
]
;
then
...
...
test/notification_test.exs
View file @
a43b899e
...
...
@@ -680,7 +680,7 @@ defmodule Pleroma.NotificationTest do
assert
Notification
.
for_user
(
user
)
==
[]
end
test
"it returns notifications f
o
r muted user w
ith notifications and
with_muted
parameter
"
do
test
"it returns notifications fr
om a
muted user w
hen
with_muted
is set
"
do
user
=
insert
(
:user
)
muted
=
insert
(
:user
)
{
:ok
,
user
}
=
User
.
mute
(
user
,
muted
)
...
...
@@ -690,27 +690,27 @@ defmodule Pleroma.NotificationTest do
assert
length
(
Notification
.
for_user
(
user
,
%{
with_muted:
true
}))
==
1
end
test
"it return
s
notifications f
o
r blocked user
and
with_muted
parameter
"
do
test
"it
doesn't
return notifications fr
om a
blocked user
when
with_muted
is set
"
do
user
=
insert
(
:user
)
blocked
=
insert
(
:user
)
{
:ok
,
user
}
=
User
.
block
(
user
,
blocked
)
{
: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
test
"it return
s
notificati
t
ons f
or blocked domain and
with_muted
parameter
"
do
test
"it
doesn't
return notifications f
rom a domain-blocked user when
with_muted
is set
"
do
user
=
insert
(
:user
)
blocked
=
insert
(
:user
,
ap_id:
"http://some-domain.com"
)
{
:ok
,
user
}
=
User
.
block_domain
(
user
,
"some-domain.com"
)
{
: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
test
"it returns notifications f
o
r muted thread with_muted
parameter
"
do
test
"it returns notifications fr
om
muted thread
s when
with_muted
is set
"
do
user
=
insert
(
:user
)
another_user
=
insert
(
:user
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment