diff --git a/CHANGELOG.md b/CHANGELOG.md index 424a8a7..ebf1864 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ # 0.15.1 * Added some rate limits. Currently each instance is limited to 20 actions per minute +* Only claimed instanced get an automatic solicitation +* Fix report for automatic notification # 0.15.0 diff --git a/fediseer/apis/v1/guarantees.py b/fediseer/apis/v1/guarantees.py index 98b7066..37bebef 100644 --- a/fediseer/apis/v1/guarantees.py +++ b/fediseer/apis/v1/guarantees.py @@ -173,22 +173,22 @@ class Guarantees(Resource): endorsement = database.get_endorsement(target_instance.id,instance.id) if endorsement: db.session.delete(endorsement) - # Orphaned instances are automatically put into the solicitation list - new_solicitation = Solicitation( - comment="Orphaned instance!", - source_id=target_instance.id, - target_id=None, - created=guarantee.created, - ) - db.session.add(new_solicitation) - solicitation_report = Report( - source_domain=target_instance.domain, - target_domain=target_instance.domain, - report_type=enums.ReportType.SOLICITATION, - report_activity=enums.ReportActivity.ADDED, - ) - db.session.add(solicitation_report) - + # Claimed Orphaned instances are automatically put into the solicitation list + if target_instance.is_claimed(): + new_solicitation = Solicitation( + comment="Orphaned instance!", + source_id=target_instance.id, + target_id=None, + created=guarantee.created, + ) + db.session.add(new_solicitation) + solicitation_report = Report( + source_domain=target_instance.domain, + target_domain=target_instance.domain, + report_type=enums.ReportType.SOLICITATION, + report_activity=enums.ReportActivity.ADDED, + ) + db.session.add(solicitation_report) db.session.delete(guarantee) rejection_record = database.get_rejection_record(instance.id,target_instance.id) if rejection_record: diff --git a/fediseer/classes/instance.py b/fediseer/classes/instance.py index 1b18e30..1bdf88f 100644 --- a/fediseer/classes/instance.py +++ b/fediseer/classes/instance.py @@ -162,4 +162,7 @@ class Instance(db.Model): def unset_as_orphan(self): self.oprhan_since = None - db.session.commit() \ No newline at end of file + db.session.commit() + + def is_claimed(self): + return len(self.admins) > 0 \ No newline at end of file