fix: no pm on private visibility endorsements

pull/36/head
db0 2023-09-25 20:18:41 +02:00
parent 8a893be55b
commit 9f4c10310e
1 changed files with 17 additions and 15 deletions

View File

@ -198,6 +198,7 @@ class Endorsements(Resource):
db.session.commit() db.session.commit()
# if not database.has_recent_endorsement(target_instance.id): # if not database.has_recent_endorsement(target_instance.id):
try: try:
if instance.visibility_endorsements != enums.ListVisibility.PRIVATE:
message = f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain}." message = f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain}."
if reason is not None: if reason is not None:
message = f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain} with reason: {reason}" message = f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain} with reason: {reason}"
@ -306,6 +307,7 @@ class Endorsements(Resource):
db.session.add(new_report) db.session.add(new_report)
db.session.commit() db.session.commit()
try: try:
if instance.visibility_endorsements != enums.ListVisibility.PRIVATE:
activitypub_pm.pm_admins( activitypub_pm.pm_admins(
message=f"Oh no. {instance.domain} has just withdrawn the endorsement of your instance", message=f"Oh no. {instance.domain} has just withdrawn the endorsement of your instance",
domain=target_instance.domain, domain=target_instance.domain,