Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pleroma
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hakaba Hitoyo
pleroma
Commits
62296f5a
Commit
62296f5a
authored
Feb 22, 2019
by
lain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix private post card handling.
parent
5a4e2905
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/activity_pub.ex
+1
-1
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+2
-2
test/web/mastodon_api/mastodon_api_controller_test.exs
test/web/mastodon_api/mastodon_api_controller_test.exs
+12
-0
No files found.
lib/pleroma/web/activity_pub/activity_pub.ex
View file @
62296f5a
...
...
@@ -943,7 +943,7 @@ def visible_for_user?(activity, nil) do
def
visible_for_user?
(
activity
,
user
)
do
x
=
[
user
.
ap_id
|
user
.
following
]
y
=
activity
.
data
[
"to"
]
++
(
activity
.
data
[
"cc"
]
||
[])
y
=
[
activity
.
actor
]
++
activity
.
data
[
"to"
]
++
(
activity
.
data
[
"cc"
]
||
[])
visible_for_user?
(
activity
,
nil
)
||
Enum
.
any?
(
x
,
&
(
&1
in
y
))
end
...
...
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
62296f5a
...
...
@@ -1518,9 +1518,9 @@ def suggestions(%{assigns: %{user: user}} = conn, _) do
end
end
def
status_card
(
conn
,
%{
"id"
=>
status_id
})
do
def
status_card
(
%{
assigns:
%{
user:
user
}}
=
conn
,
%{
"id"
=>
status_id
})
do
with
%
Activity
{}
=
activity
<-
Repo
.
get
(
Activity
,
status_id
),
true
<-
ActivityPub
.
is_public?
(
activity
)
do
true
<-
ActivityPub
.
visible_for_user?
(
activity
,
user
)
do
data
=
StatusView
.
render
(
"card.json"
,
...
...
test/web/mastodon_api/mastodon_api_controller_test.exs
View file @
62296f5a
...
...
@@ -1744,6 +1744,18 @@ test "Status rich-media Card", %{conn: conn, user: user} do
}
}
# works with private posts
{
:ok
,
activity
}
=
CommonAPI
.
post
(
user
,
%{
"status"
=>
"http://example.com/ogp"
,
"visibility"
=>
"direct"
})
response_two
=
conn
|>
assign
(
:user
,
user
)
|>
get
(
"/api/v1/statuses/
#{
activity
.
id
}
/card"
)
|>
json_response
(
200
)
assert
response_two
==
response
Pleroma
.
Config
.
put
([
:rich_media
,
:enabled
],
false
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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