forked from AkkomaGang/akkoma
Merge branch 'bugfix/poll_replies_count' into 'develop'
side_effects: Don’t increase_replies_count when it’s an Answer Closes #2274 See merge request pleroma/pleroma!3114
This commit is contained in:
commit
24ce324973
2 changed files with 3 additions and 2 deletions
|
@ -187,7 +187,7 @@ def handle(%{data: %{"type" => "Create"}} = activity, meta) do
|
||||||
{:ok, notifications} = Notification.create_notifications(activity, do_send: false)
|
{:ok, notifications} = Notification.create_notifications(activity, do_send: false)
|
||||||
{:ok, _user} = ActivityPub.increase_note_count_if_public(user, object)
|
{:ok, _user} = ActivityPub.increase_note_count_if_public(user, object)
|
||||||
|
|
||||||
if in_reply_to = object.data["inReplyTo"] do
|
if in_reply_to = object.data["inReplyTo"] && object.data["type"] != "Answer" do
|
||||||
Object.increase_replies_count(in_reply_to)
|
Object.increase_replies_count(in_reply_to)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ test "incoming, rewrites Note to Answer and increments vote counters" do
|
||||||
})
|
})
|
||||||
|
|
||||||
object = Object.normalize(activity)
|
object = Object.normalize(activity)
|
||||||
|
assert object.data["repliesCount"] == nil
|
||||||
|
|
||||||
data =
|
data =
|
||||||
File.read!("test/fixtures/mastodon-vote.json")
|
File.read!("test/fixtures/mastodon-vote.json")
|
||||||
|
@ -41,7 +42,7 @@ test "incoming, rewrites Note to Answer and increments vote counters" do
|
||||||
assert answer_object.data["inReplyTo"] == object.data["id"]
|
assert answer_object.data["inReplyTo"] == object.data["id"]
|
||||||
|
|
||||||
new_object = Object.get_by_ap_id(object.data["id"])
|
new_object = Object.get_by_ap_id(object.data["id"])
|
||||||
assert new_object.data["replies_count"] == object.data["replies_count"]
|
assert new_object.data["repliesCount"] == nil
|
||||||
|
|
||||||
assert Enum.any?(
|
assert Enum.any?(
|
||||||
new_object.data["oneOf"],
|
new_object.data["oneOf"],
|
||||||
|
|
Loading…
Reference in a new issue