Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
f18b86fd
Commit
f18b86fd
authored
Dec 01, 2018
by
lain
Browse files
More fixes for Info schema.
parent
93f2dc19
Pipeline
#4808
passed with stages
in 2 minutes and 30 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/plugs/user_enabled_plug.ex
View file @
f18b86fd
...
...
@@ -6,7 +6,7 @@ def init(options) do
options
end
def
call
(%{
assigns:
%{
user:
%
User
{
info:
%{
"
deactivated
"
=>
true
}}}}
=
conn
,
_
)
do
def
call
(%{
assigns:
%{
user:
%
User
{
info:
%{
deactivated
:
true
}}}}
=
conn
,
_
)
do
conn
|>
assign
(
:user
,
nil
)
end
...
...
lib/pleroma/user.ex
View file @
f18b86fd
...
...
@@ -682,7 +682,7 @@ def delete(%User{} = user) do
{
:ok
,
user
}
end
def
html_filter_policy
(%
User
{
info:
%{
"
no_rich_text
"
=>
true
}})
do
def
html_filter_policy
(%
User
{
info:
%{
no_rich_text
:
true
}})
do
Pleroma
.
HTML
.
Scrubber
.
TwitterText
end
...
...
lib/pleroma/user/info.ex
View file @
f18b86fd
...
...
@@ -23,6 +23,7 @@ defmodule Pleroma.User.Info do
field
(
:uri
,
:string
,
default:
nil
)
field
(
:topic
,
:string
,
default:
nil
)
field
(
:hub
,
:string
,
default:
nil
)
field
(
:salmon
,
:string
,
default:
nil
)
# Found in the wild
# ap_id -> Where is this used?
...
...
@@ -30,11 +31,7 @@ defmodule Pleroma.User.Info do
# avatar -> Where is this used?
# fqn -> Where is this used?
# host -> Where is this used?
# name -> Where is this used?
# nickname -> Where is this used?
# salmon -> Where is this used?
# subject _> Where is this used?
# subscribe_address -> Where is this used?
end
def
set_activation_status
(
info
,
deactivated
)
do
...
...
@@ -115,7 +112,8 @@ def remote_user_creation(info, params) do
:magic_key
,
:uri
,
:hub
,
:topic
:topic
,
:salmon
])
end
...
...
lib/pleroma/web/salmon/salmon.ex
View file @
f18b86fd
...
...
@@ -157,7 +157,7 @@ def remote_users(%{data: %{"to" => to} = data}) do
|>
Enum
.
filter
(
fn
user
->
user
&&
!user
.
local
end
)
end
defp
send_to_user
(%{
info:
%{
"
salmon
"
=>
salmon
}},
feed
,
poster
)
do
defp
send_to_user
(%{
info:
%{
salmon
:
salmon
}},
feed
,
poster
)
do
with
{
:ok
,
%{
status_code:
code
}}
<-
poster
.
(
salmon
,
...
...
@@ -185,7 +185,7 @@ defp send_to_user(_, _, _), do: nil
]
def
publish
(
user
,
activity
,
poster
\\
&
@httpoison
.
post
/
4
)
def
publish
(%{
info:
%{
"
keys
"
=>
keys
}}
=
user
,
%{
data:
%{
"type"
=>
type
}}
=
activity
,
poster
)
def
publish
(%{
info:
%{
keys
:
keys
}}
=
user
,
%{
data:
%{
"type"
=>
type
}}
=
activity
,
poster
)
when
type
in
@supported_activities
do
feed
=
ActivityRepresenter
.
to_simple_form
(
activity
,
user
,
true
)
...
...
test/plugs/user_enabled_plug_test.exs
View file @
f18b86fd
...
...
@@ -13,7 +13,7 @@ test "doesn't do anything if the user isn't set", %{conn: conn} do
end
test
"with a user that is deactivated, it removes that user"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
info:
%{
"
deactivated
"
=>
true
})
user
=
insert
(
:user
,
info:
%{
deactivated
:
true
})
conn
=
conn
...
...
test/user_test.exs
View file @
f18b86fd
...
...
@@ -548,7 +548,7 @@ test "html_filter_policy returns nil when rich-text is enabled" do
end
test
"html_filter_policy returns TwitterText scrubber when rich-text is disabled"
do
user
=
insert
(
:user
,
%{
info:
%{
"
no_rich_text
"
=>
true
}})
user
=
insert
(
:user
,
%{
info:
%{
no_rich_text
:
true
}})
assert
Pleroma
.
HTML
.
Scrubber
.
TwitterText
==
User
.
html_filter_policy
(
user
)
end
...
...
test/web/ostatus/ostatus_test.exs
View file @
f18b86fd
...
...
@@ -329,6 +329,38 @@ test "tries to use the information in poco fields" do
assert
user
==
user_again
end
test
"find_or_make_user sets all the nessary input fields"
do
uri
=
"https://social.heldscal.la/user/23211"
{
:ok
,
user
}
=
OStatus
.
find_or_make_user
(
uri
)
assert
user
.
info
==
%
Pleroma
.
User
.
Info
{
id:
user
.
info
.
id
,
ap_enabled:
false
,
background:
nil
,
banner:
%{},
blocks:
[],
deactivated:
false
,
default_scope:
"public"
,
domain_blocks:
[],
follower_count:
0
,
is_admin:
false
,
is_moderator:
false
,
keys:
nil
,
locked:
false
,
no_rich_text:
false
,
note_count:
0
,
settings:
nil
,
source_data:
%{},
hub:
"https://social.heldscal.la/main/push/hub"
,
magic_key:
"RSA.uzg6r1peZU0vXGADWxGJ0PE34WvmhjUmydbX5YYdOiXfODVLwCMi1umGoqUDm-mRu4vNEdFBVJU1CpFA7dKzWgIsqsa501i2XqElmEveXRLvNRWFB6nG03Q5OUY2as8eE54BJm0p20GkMfIJGwP6TSFb-ICp3QjzbatuSPJ6xCE=.AQAB"
,
salmon:
"https://social.heldscal.la/main/salmon/user/23211"
,
topic:
"https://social.heldscal.la/api/statuses/user_timeline/23211.atom"
,
uri:
"https://social.heldscal.la/user/23211"
}
end
test
"find_make_or_update_user takes an author element and returns an updated user"
do
uri
=
"https://social.heldscal.la/user/23211"
...
...
test/web/twitter_api/twitter_api_controller_test.exs
View file @
f18b86fd
...
...
@@ -1163,7 +1163,7 @@ test "with credentials and valid password", %{conn: conn, user: current_user} do
describe
"GET /api/pleroma/friend_requests"
do
test
"it lists friend requests"
do
user
=
insert
(
:user
,
%{
info:
%{
"locked"
=>
true
}}
)
user
=
insert
(
:user
)
other_user
=
insert
(
:user
)
{
:ok
,
_activity
}
=
ActivityPub
.
follow
(
other_user
,
user
)
...
...
@@ -1185,7 +1185,7 @@ test "it lists friend requests" do
describe
"POST /api/pleroma/friendships/approve"
do
test
"it approves a friend request"
do
user
=
insert
(
:user
,
%{
info:
%{
"locked"
=>
true
}}
)
user
=
insert
(
:user
)
other_user
=
insert
(
:user
)
{
:ok
,
_activity
}
=
ActivityPub
.
follow
(
other_user
,
user
)
...
...
@@ -1208,7 +1208,7 @@ test "it approves a friend request" do
describe
"POST /api/pleroma/friendships/deny"
do
test
"it denies a friend request"
do
user
=
insert
(
:user
,
%{
info:
%{
"locked"
=>
true
}}
)
user
=
insert
(
:user
)
other_user
=
insert
(
:user
)
{
:ok
,
_activity
}
=
ActivityPub
.
follow
(
other_user
,
user
)
...
...
Write
Preview
Supports
Markdown
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