From 5b4fe4f4423324ea4d25b5fec0406bde8fc327e4 Mon Sep 17 00:00:00 2001 From: db0 Date: Sun, 17 Sep 2023 22:10:59 +0200 Subject: [PATCH] show reason on endorsements --- fediseer/apis/v1/endorsements.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fediseer/apis/v1/endorsements.py b/fediseer/apis/v1/endorsements.py index 7bd0b5e..5af1f38 100644 --- a/fediseer/apis/v1/endorsements.py +++ b/fediseer/apis/v1/endorsements.py @@ -144,16 +144,19 @@ class Endorsements(Resource): ) db.session.add(new_report) db.session.commit() - if not database.has_recent_endorsement(target_instance.id): - try: - activitypub_pm.pm_admins( - message=f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain}", - domain=target_instance.domain, - software=target_instance.software, - instance=target_instance, - ) - except: - pass + # if not database.has_recent_endorsement(target_instance.id): + try: + message = f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain}." + 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}" + activitypub_pm.pm_admins( + message=message, + domain=target_instance.domain, + software=target_instance.software, + instance=target_instance, + ) + except: + pass logger.info(f"{instance.domain} Endorsed {domain}") return {"message":'Changed'}, 200