Merge branch 'validate-user-info' of git.pleroma.social:pleroma/pleroma into validate-user-info
This commit is contained in:
commit
0bea0308f1
|
@ -20,7 +20,7 @@ def call(conn, _) do
|
|||
with token when not is_nil(token) <- token,
|
||||
%Token{user_id: user_id} <- Repo.get_by(Token, token: token),
|
||||
%User{} = user <- Repo.get(User, user_id),
|
||||
false <- !!user.info["deactivated"] do
|
||||
false <- !!user.info.deactivated do
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
else
|
||||
|
|
|
@ -284,7 +284,7 @@ def following?(%User{} = follower, %User{} = followed) do
|
|||
end
|
||||
|
||||
def locked?(%User{} = user) do
|
||||
user.info["locked"] || false
|
||||
user.info.locked || false
|
||||
end
|
||||
|
||||
def get_by_ap_id(ap_id) do
|
||||
|
|
|
@ -173,7 +173,7 @@ def push_to_socket(topics, topic, %Activity{data: %{"type" => "Announce"}} = ite
|
|||
Enum.each(topics[topic] || [], fn socket ->
|
||||
# Get the current user so we have up-to-date blocks etc.
|
||||
user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id)
|
||||
blocks = user.info["blocks"] || []
|
||||
blocks = user.info.blocks || []
|
||||
|
||||
parent = Object.normalize(item.data["object"])
|
||||
|
||||
|
@ -187,7 +187,7 @@ def push_to_socket(topics, topic, item) do
|
|||
Enum.each(topics[topic] || [], fn socket ->
|
||||
# Get the current user so we have up-to-date blocks etc.
|
||||
user = User.get_cached_by_ap_id(socket.assigns[:user].ap_id)
|
||||
blocks = user.info["blocks"] || []
|
||||
blocks = user.info.blocks || []
|
||||
|
||||
unless item.actor in blocks do
|
||||
send(socket.transport_pid, {:text, represent_update(item, user)})
|
||||
|
|
|
@ -17,7 +17,7 @@ test "Represent a user account" do
|
|||
|
||||
user =
|
||||
insert(:user, %{
|
||||
info: %{"note_count" => 5, "follower_count" => 3, "source_data" => source_data},
|
||||
info: %{note_count: 5, follower_count: 3, source_data: source_data},
|
||||
nickname: "shp@shitposter.club",
|
||||
name: ":karjalanpiirakka: shp",
|
||||
bio: "<script src=\"invalid-html\"></script><span>valid html</span>",
|
||||
|
@ -63,7 +63,7 @@ test "Represent a user account" do
|
|||
test "Represent a Service(bot) account" do
|
||||
user =
|
||||
insert(:user, %{
|
||||
info: %{"note_count" => 5, "follower_count" => 3, "source_data" => %{"type" => "Service"}},
|
||||
info: %{note_count: 5, follower_count: 3, source_data: %{"type" => "Service"}},
|
||||
nickname: "shp@shitposter.club",
|
||||
inserted_at: ~N[2017-08-15 15:47:06.597036]
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue