show reason on endorsements

pull/26/head
db0 2023-09-17 22:10:59 +02:00
parent f8b4eeee51
commit 5b4fe4f442
1 changed files with 13 additions and 10 deletions

View File

@ -144,16 +144,19 @@ class Endorsements(Resource):
) )
db.session.add(new_report) db.session.add(new_report)
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:
activitypub_pm.pm_admins( 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:
domain=target_instance.domain, message = f"Your instance has just been [endorsed](https://fediseer.com/faq#what-is-an-endorsement) by {instance.domain} with reason: {reason}"
software=target_instance.software, activitypub_pm.pm_admins(
instance=target_instance, message=message,
) domain=target_instance.domain,
except: software=target_instance.software,
pass instance=target_instance,
)
except:
pass
logger.info(f"{instance.domain} Endorsed {domain}") logger.info(f"{instance.domain} Endorsed {domain}")
return {"message":'Changed'}, 200 return {"message":'Changed'}, 200