1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-24 17:55:47 +01:00

side_effects: Don’t increase_replies_count when it’s an Answer

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-11-02 05:43:06 +01:00
parent 073ad7e6d9
commit 4caad4e910
No known key found for this signature in database
GPG Key ID: D5B7A8E43C997DEE
2 changed files with 3 additions and 2 deletions

View File

@ -187,7 +187,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
{:ok, notifications} = Notification.create_notifications(activity, do_send: false)
{: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)
end

View File

@ -27,6 +27,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnswerHandlingTest do
})
object = Object.normalize(activity)
assert object.data["repliesCount"] == nil
data =
File.read!("test/fixtures/mastodon-vote.json")
@ -41,7 +42,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnswerHandlingTest do
assert answer_object.data["inReplyTo"] == 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?(
new_object.data["oneOf"],