"muting": false,
"muting_notifications": false,
"subscribing": true,
+ "notifying": true,
"requested": false,
"domain_blocking": false,
"showing_reblogs": true,
"muting": false,
"muting_notifications": false,
"subscribing": false,
+ "notifying": false,
"requested": false,
"domain_blocking": false,
"showing_reblogs": true,
"requested" => false,
"domain_blocking" => false,
"subscribing" => false,
+ "notifying" => false,
"endorsed" => true
},
%{
"requested" => true,
"domain_blocking" => false,
"subscribing" => false,
+ "notifying" => false,
"endorsed" => false
},
%{
"requested" => false,
"domain_blocking" => true,
"subscribing" => true,
+ "notifying" => true,
"endorsed" => false
}
]
"muting_notifications" => false,
"requested" => false,
"showing_reblogs" => true,
- "subscribing" => false
+ "subscribing" => false,
+ "notifying" => false
},
"settings_store" => %{
"pleroma-fe" => %{}
muting_notifications: %Schema{type: :boolean},
requested: %Schema{type: :boolean},
showing_reblogs: %Schema{type: :boolean},
- subscribing: %Schema{type: :boolean}
+ subscribing: %Schema{type: :boolean},
+ notifying: %Schema{type: :boolean}
},
example: %{
"blocked_by" => false,
"muting_notifications" => false,
"requested" => false,
"showing_reblogs" => true,
- "subscribing" => false
+ "subscribing" => false,
+ "notifying" => false
}
})
end
"muting_notifications" => false,
"requested" => false,
"showing_reblogs" => true,
- "subscribing" => false
+ "subscribing" => false,
+ "notifying" => false
},
"skip_thread_containment" => false,
"tags" => []
User.subscribe(follower, followed)
end
- defp set_subscription(_, {:ok, follower, followed, _}) do
+ defp set_subscription(false, {:ok, follower, followed, _}) do
User.unsubscribe(follower, followed)
end
+ defp set_subscription(_, _), do: {:ok, nil}
+
@spec get_followers(User.t(), map()) :: list(User.t())
def get_followers(user, params \\ %{}) do
user
User.following?(target, reading_user)
end
+ subscribing =
+ UserRelationship.exists?(
+ user_relationships,
+ :inverse_subscription,
+ target,
+ reading_user,
+ &User.subscribed_to?(&2, &1)
+ )
+
# NOTE: adjust UserRelationship.view_relationships_option/2 on new relation-related flags
%{
id: to_string(target.id),
target,
&User.muted_notifications?(&1, &2)
),
- subscribing:
- UserRelationship.exists?(
- user_relationships,
- :inverse_subscription,
- target,
- reading_user,
- &User.subscribed_to?(&2, &1)
- ),
+ subscribing: subscribing,
+ notifying: subscribing,
requested: follow_state == :follow_pending,
domain_blocking: User.blocks_domain?(reading_user, target),
showing_reblogs:
|> json_response_and_validate_schema(200)
end
- test "following with subscription and unsubscribing when notify is nil" do
+ test "following with subscription and unsubscribing" do
%{conn: conn} = oauth_access(["follow"])
followed = insert(:user)
ret_conn =
conn
|> put_req_header("content-type", "application/json")
- |> post("/api/v1/accounts/#{followed.id}/follow")
+ |> post("/api/v1/accounts/#{followed.id}/follow", %{notify: false})
assert %{"id" => _id, "subscribing" => false} =
json_response_and_validate_schema(ret_conn, 200)
muting: false,
muting_notifications: false,
subscribing: false,
+ notifying: false,
requested: false,
domain_blocking: false,
showing_reblogs: true,
muting: true,
muting_notifications: true,
subscribing: true,
+ notifying: true,
showing_reblogs: false,
id: to_string(other_user.id)
}