aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-04-17 15:54:09 +0300
committerrinpatch <rinpatch@sdf.org>2019-04-17 15:54:09 +0300
commit8e4d950f31ec3ea956f6892f9f36b419344bf930 (patch)
treeed6e95b017b6633b7f3ad5d9ce378ffd5948b79f /lib
parentff8d76c670eb25213948974d03bbc389421558a6 (diff)
downloadpleroma-8e4d950f31ec3ea956f6892f9f36b419344bf930.tar.gz
Remove updating reply count for embeded objects
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/activity.ex50
-rw-r--r--lib/pleroma/web/activity_pub/activity_pub.ex2
2 files changed, 0 insertions, 52 deletions
diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex
index 99cc9c077..478d16356 100644
--- a/lib/pleroma/activity.ex
+++ b/lib/pleroma/activity.ex
@@ -257,54 +257,4 @@ defmodule Pleroma.Activity do
|> where([s], s.actor == ^actor)
|> Repo.all()
end
-
- def increase_replies_count(nil), do: nil
-
- def increase_replies_count(object_ap_id) do
- from(a in create_by_object_ap_id(object_ap_id),
- update: [
- set: [
- data:
- fragment(
- """
- jsonb_set(?, '{object, repliesCount}',
- (coalesce((?->'object'->>'repliesCount')::int, 0) + 1)::varchar::jsonb, true)
- """,
- a.data,
- a.data
- )
- ]
- ]
- )
- |> Repo.update_all([])
- |> case do
- {1, [activity]} -> activity
- _ -> {:error, "Not found"}
- end
- end
-
- def decrease_replies_count(nil), do: nil
-
- def decrease_replies_count(object_ap_id) do
- from(a in create_by_object_ap_id(object_ap_id),
- update: [
- set: [
- data:
- fragment(
- """
- jsonb_set(?, '{object, repliesCount}',
- (greatest(0, (?->'object'->>'repliesCount')::int - 1))::varchar::jsonb, true)
- """,
- a.data,
- a.data
- )
- ]
- ]
- )
- |> Repo.update_all([])
- |> case do
- {1, [activity]} -> activity
- _ -> {:error, "Not found"}
- end
- end
end
diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex
index 1a3b47cb3..28fca6116 100644
--- a/lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/lib/pleroma/web/activity_pub/activity_pub.ex
@@ -95,7 +95,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
"type" => "Create"
}) do
if is_public?(object) do
- Activity.increase_replies_count(reply_ap_id)
Object.increase_replies_count(reply_ap_id)
end
end
@@ -106,7 +105,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
data: %{"inReplyTo" => reply_ap_id} = object
}) do
if is_public?(object) do
- Activity.decrease_replies_count(reply_ap_id)
Object.decrease_replies_count(reply_ap_id)
end
end