X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fobject.ex;h=d9b41d710cebb6296a3b2d4cb41521feb2c27030;hb=248020075982a18534aebec3ff63eee0ae6185f4;hp=cdfbacb0e783c3610f3b9332696c77b929fa7c05;hpb=64095961fe490029886cae358683532ea65bf2c0;p=akkoma diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index cdfbacb0e..d9b41d710 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -181,7 +181,7 @@ defmodule Pleroma.Object do data: fragment( """ - jsonb_set(?, '{repliesCount}', + safe_jsonb_set(?, '{repliesCount}', (coalesce((?->>'repliesCount')::int, 0) + 1)::varchar::jsonb, true) """, o.data, @@ -204,7 +204,7 @@ defmodule Pleroma.Object do data: fragment( """ - jsonb_set(?, '{repliesCount}', + safe_jsonb_set(?, '{repliesCount}', (greatest(0, (?->>'repliesCount')::int - 1))::varchar::jsonb, true) """, o.data,