diff --git a/fediseer/apis/v1/censures.py b/fediseer/apis/v1/censures.py index 68bc0d1..220b79c 100644 --- a/fediseer/apis/v1/censures.py +++ b/fediseer/apis/v1/censures.py @@ -210,7 +210,7 @@ class Censures(Resource): raise e.BadRequest("You can't censure an instance you've endorsed! Please withdraw the endorsement first.") if database.get_censure(target_instance.id,instance.id): return {"message":'OK'}, 200 - if database.count_all_censured_instances_by_censuring_id(instance.id) >= instance.max_list_size: + if database.count_all_censured_instances_by_censuring_id([instance.id]) >= instance.max_list_size: raise e.Forbidden("You're reached the maximum amount of instances you can add to your censures. Please contact the admins of fediseer to increase this limit is needed.") reason = self.args.reason if reason is not None: diff --git a/fediseer/apis/v1/endorsements.py b/fediseer/apis/v1/endorsements.py index e0b5e51..d70162a 100644 --- a/fediseer/apis/v1/endorsements.py +++ b/fediseer/apis/v1/endorsements.py @@ -190,6 +190,8 @@ class Endorsements(Resource): raise e.BadRequest("You can't endorse an instance you've censured! Please withdraw the censure first.") if database.get_endorsement(target_instance.id,instance.id): return {"message":'OK'}, 200 + if database.count_all_endorsed_instances_by_approving_id([instance.id]) >= instance.max_list_size: + raise e.Forbidden("You're reached the maximum amount of instances you can add to your endorsements. Please contact the admins of fediseer to increase this limit is needed.") reason = self.args.reason if reason is not None: reason = sanitize_string(reason) diff --git a/fediseer/apis/v1/hesitations.py b/fediseer/apis/v1/hesitations.py index 32fdb9c..05f0563 100644 --- a/fediseer/apis/v1/hesitations.py +++ b/fediseer/apis/v1/hesitations.py @@ -198,7 +198,8 @@ class Hesitations(Resource): raise e.BadRequest("You can't hesitate against an instance you've endorsed! Please withdraw the endorsement first.") if database.get_hesitation(target_instance.id,instance.id): return {"message":'OK'}, 200 - + if database.count_all_dubious_instances_by_hesitant_id([instance.id]) >= instance.max_list_size: + raise e.Forbidden("You're reached the maximum amount of instances you can add to your hesitations. Please contact the admins of fediseer to increase this limit is needed.") reason = self.args.reason if reason is not None: reason = sanitize_string(reason)