fix: only auto-solicit claimed instances

pull/26/head
db0 2023-09-18 00:00:28 +02:00
parent bcac7b29c8
commit bb4edcecda
3 changed files with 22 additions and 17 deletions

View File

@ -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

View File

@ -173,7 +173,8 @@ 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
# 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,
@ -188,7 +189,6 @@ class Guarantees(Resource):
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:

View File

@ -163,3 +163,6 @@ class Instance(db.Model):
def unset_as_orphan(self):
self.oprhan_since = None
db.session.commit()
def is_claimed(self):
return len(self.admins) > 0