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
74518d0b
Commit
74518d0b
authored
Feb 06, 2019
by
feld
Browse files
hide_followings was renamed to hide_followers in the FE, but never synced up in the BE
This was a dirty regex replace which worked on my server
parent
1220a171
Changes
9
Hide whitespace changes
Inline
Side-by-side
lib/pleroma/user/info.ex
View file @
74518d0b
...
...
@@ -32,7 +32,7 @@ defmodule Pleroma.User.Info do
field
(
:hub
,
:string
,
default:
nil
)
field
(
:salmon
,
:string
,
default:
nil
)
field
(
:hide_followers
,
:boolean
,
default:
false
)
field
(
:hide_follow
ing
s
,
:boolean
,
default:
false
)
field
(
:hide_follows
,
:boolean
,
default:
false
)
field
(
:pinned_activities
,
{
:array
,
:string
},
default:
[])
# Found in the wild
...
...
@@ -145,7 +145,7 @@ def profile_update(info, params) do
:no_rich_text
,
:default_scope
,
:banner
,
:hide_follow
ing
s
,
:hide_follows
,
:hide_followers
,
:background
,
:show_role
...
...
lib/pleroma/web/activity_pub/views/user_view.ex
View file @
74518d0b
...
...
@@ -86,7 +86,7 @@ def render("following.json", %{user: user, page: page}) do
query
=
from
(
user
in
query
,
select:
[
:ap_id
])
following
=
Repo
.
all
(
query
)
collection
(
following
,
"
#{
user
.
ap_id
}
/following"
,
page
,
!user
.
info
.
hide_follow
ing
s
)
collection
(
following
,
"
#{
user
.
ap_id
}
/following"
,
page
,
!user
.
info
.
hide_follows
)
|>
Map
.
merge
(
Utils
.
make_json_ld_header
())
end
...
...
@@ -99,7 +99,7 @@ def render("following.json", %{user: user}) do
"id"
=>
"
#{
user
.
ap_id
}
/following"
,
"type"
=>
"OrderedCollection"
,
"totalItems"
=>
length
(
following
),
"first"
=>
collection
(
following
,
"
#{
user
.
ap_id
}
/following"
,
1
,
!user
.
info
.
hide_follow
ing
s
)
"first"
=>
collection
(
following
,
"
#{
user
.
ap_id
}
/following"
,
1
,
!user
.
info
.
hide_follows
)
}
|>
Map
.
merge
(
Utils
.
make_json_ld_header
())
end
...
...
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
View file @
74518d0b
...
...
@@ -621,7 +621,7 @@ def following(%{assigns: %{user: for_user}} = conn, %{"id" => id}) do
followers
=
cond
do
for_user
&&
user
.
id
==
for_user
.
id
->
followers
user
.
info
.
hide_follow
ing
s
->
[]
user
.
info
.
hide_follows
->
[]
true
->
followers
end
...
...
lib/pleroma/web/twitter_api/twitter_api_controller.ex
View file @
74518d0b
...
...
@@ -523,7 +523,7 @@ def friends(%{assigns: %{user: for_user}} = conn, params) do
friends
=
cond
do
for_user
&&
user
.
id
==
for_user
.
id
->
friends
user
.
info
.
hide_follow
ing
s
->
[]
user
.
info
.
hide_follows
->
[]
true
->
friends
end
...
...
@@ -618,7 +618,7 @@ def raw_empty_array(conn, _params) do
defp
build_info_cng
(
user
,
params
)
do
info_params
=
[
"no_rich_text"
,
"locked"
,
"hide_followers"
,
"hide_follow
ing
s"
,
"show_role"
]
[
"no_rich_text"
,
"locked"
,
"hide_followers"
,
"hide_follows"
,
"show_role"
]
|>
Enum
.
reduce
(%{},
fn
key
,
res
->
if
value
=
params
[
key
]
do
Map
.
put
(
res
,
key
,
value
==
"true"
)
...
...
lib/pleroma/web/twitter_api/views/user_view.ex
View file @
74518d0b
...
...
@@ -109,7 +109,7 @@ defp do_render("user.json", %{user: user = %User{}} = assigns) do
"default_scope"
=>
user
.
info
.
default_scope
,
"no_rich_text"
=>
user
.
info
.
no_rich_text
,
"hide_followers"
=>
user
.
info
.
hide_followers
,
"hide_follow
ing
s"
=>
user
.
info
.
hide_follow
ing
s
,
"hide_follows"
=>
user
.
info
.
hide_follows
,
"fields"
=>
fields
,
# Pleroma extension
...
...
test/web/activity_pub/activity_pub_controller_test.exs
View file @
74518d0b
...
...
@@ -441,8 +441,8 @@ test "it returns the following in a collection", %{conn: conn} do
assert
result
[
"first"
][
"orderedItems"
]
==
[
user_two
.
ap_id
]
end
test
"it returns returns empty if the user has 'hide_follow
ing
s' set"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follow
ing
s:
true
}})
test
"it returns returns empty if the user has 'hide_follows' set"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follows:
true
}})
user_two
=
insert
(
:user
)
User
.
follow
(
user
,
user_two
)
...
...
test/web/mastodon_api/mastodon_api_controller_test.exs
View file @
74518d0b
...
...
@@ -1139,8 +1139,8 @@ test "getting following", %{conn: conn} do
assert
id
==
to_string
(
other_user
.
id
)
end
test
"getting following, hide_follow
ing
s"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follow
ing
s:
true
}})
test
"getting following, hide_follows"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follows:
true
}})
other_user
=
insert
(
:user
)
{
:ok
,
user
}
=
User
.
follow
(
user
,
other_user
)
...
...
@@ -1151,8 +1151,8 @@ test "getting following, hide_followings", %{conn: conn} do
assert
[]
==
json_response
(
conn
,
200
)
end
test
"getting following, hide_follow
ing
s, same user requesting"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follow
ing
s:
true
}})
test
"getting following, hide_follows, same user requesting"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follows:
true
}})
other_user
=
insert
(
:user
)
{
:ok
,
user
}
=
User
.
follow
(
user
,
other_user
)
...
...
test/web/twitter_api/twitter_api_controller_test.exs
View file @
74518d0b
...
...
@@ -1261,8 +1261,8 @@ test "it returns a given user's friends with user_id", %{conn: conn} do
)
end
test
"it returns empty when hide_follow
ing
s is set to true"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follow
ing
s:
true
}})
test
"it returns empty when hide_follows is set to true"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follows:
true
}})
followed_one
=
insert
(
:user
)
followed_two
=
insert
(
:user
)
not_followed
=
insert
(
:user
)
...
...
@@ -1278,11 +1278,11 @@ test "it returns empty when hide_followings is set to true", %{conn: conn} do
assert
[]
==
json_response
(
conn
,
200
)
end
test
"it returns friends when hide_follow
ing
s is set to true if the user themselves request it"
,
test
"it returns friends when hide_follows is set to true if the user themselves request it"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
,
%{
info:
%{
hide_follow
ing
s:
true
}})
user
=
insert
(
:user
,
%{
info:
%{
hide_follows:
true
}})
followed_one
=
insert
(
:user
)
followed_two
=
insert
(
:user
)
_not_followed
=
insert
(
:user
)
...
...
@@ -1370,27 +1370,27 @@ test "it updates a user's profile", %{conn: conn} do
assert
json_response
(
conn
,
200
)
==
UserView
.
render
(
"user.json"
,
%{
user:
user
,
for:
user
})
end
test
"it sets and un-sets hide_follow
ing
s"
,
%{
conn:
conn
}
do
test
"it sets and un-sets hide_follows"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
)
conn
|>
assign
(
:user
,
user
)
|>
post
(
"/api/account/update_profile.json"
,
%{
"hide_follow
ing
s"
=>
"true"
"hide_follows"
=>
"true"
})
user
=
Repo
.
get!
(
User
,
user
.
id
)
assert
user
.
info
.
hide_follow
ing
s
==
true
assert
user
.
info
.
hide_follows
==
true
conn
=
conn
|>
assign
(
:user
,
user
)
|>
post
(
"/api/account/update_profile.json"
,
%{
"hide_follow
ing
s"
=>
"false"
"hide_follows"
=>
"false"
})
user
=
Repo
.
get!
(
User
,
user
.
id
)
assert
user
.
info
.
hide_follow
ing
s
==
false
assert
user
.
info
.
hide_follows
==
false
assert
json_response
(
conn
,
200
)
==
UserView
.
render
(
"user.json"
,
%{
user:
user
,
for:
user
})
end
...
...
test/web/twitter_api/views/user_view_test.exs
View file @
74518d0b
...
...
@@ -100,7 +100,7 @@ test "A user" do
"locked"
=>
false
,
"default_scope"
=>
"public"
,
"no_rich_text"
=>
false
,
"hide_follow
ing
s"
=>
false
,
"hide_follows"
=>
false
,
"hide_followers"
=>
false
,
"fields"
=>
[],
"pleroma"
=>
%{
...
...
@@ -148,7 +148,7 @@ test "A user for a given other follower", %{user: user} do
"locked"
=>
false
,
"default_scope"
=>
"public"
,
"no_rich_text"
=>
false
,
"hide_follow
ing
s"
=>
false
,
"hide_follows"
=>
false
,
"hide_followers"
=>
false
,
"fields"
=>
[],
"pleroma"
=>
%{
...
...
@@ -197,7 +197,7 @@ test "A user that follows you", %{user: user} do
"locked"
=>
false
,
"default_scope"
=>
"public"
,
"no_rich_text"
=>
false
,
"hide_follow
ing
s"
=>
false
,
"hide_follows"
=>
false
,
"hide_followers"
=>
false
,
"fields"
=>
[],
"pleroma"
=>
%{
...
...
@@ -276,7 +276,7 @@ test "A blocked user for the blocker" do
"locked"
=>
false
,
"default_scope"
=>
"public"
,
"no_rich_text"
=>
false
,
"hide_follow
ing
s"
=>
false
,
"hide_follows"
=>
false
,
"hide_followers"
=>
false
,
"fields"
=>
[],
"pleroma"
=>
%{
...
...
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