fix: only auto-solicit claimed instances
parent
bcac7b29c8
commit
bb4edcecda
|
@ -3,6 +3,8 @@
|
||||||
# 0.15.1
|
# 0.15.1
|
||||||
|
|
||||||
* Added some rate limits. Currently each instance is limited to 20 actions per minute
|
* 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
|
# 0.15.0
|
||||||
|
|
||||||
|
|
|
@ -173,22 +173,22 @@ class Guarantees(Resource):
|
||||||
endorsement = database.get_endorsement(target_instance.id,instance.id)
|
endorsement = database.get_endorsement(target_instance.id,instance.id)
|
||||||
if endorsement:
|
if endorsement:
|
||||||
db.session.delete(endorsement)
|
db.session.delete(endorsement)
|
||||||
# Orphaned instances are automatically put into the solicitation list
|
# Claimed Orphaned instances are automatically put into the solicitation list
|
||||||
new_solicitation = Solicitation(
|
if target_instance.is_claimed():
|
||||||
comment="Orphaned instance!",
|
new_solicitation = Solicitation(
|
||||||
source_id=target_instance.id,
|
comment="Orphaned instance!",
|
||||||
target_id=None,
|
source_id=target_instance.id,
|
||||||
created=guarantee.created,
|
target_id=None,
|
||||||
)
|
created=guarantee.created,
|
||||||
db.session.add(new_solicitation)
|
)
|
||||||
solicitation_report = Report(
|
db.session.add(new_solicitation)
|
||||||
source_domain=target_instance.domain,
|
solicitation_report = Report(
|
||||||
target_domain=target_instance.domain,
|
source_domain=target_instance.domain,
|
||||||
report_type=enums.ReportType.SOLICITATION,
|
target_domain=target_instance.domain,
|
||||||
report_activity=enums.ReportActivity.ADDED,
|
report_type=enums.ReportType.SOLICITATION,
|
||||||
)
|
report_activity=enums.ReportActivity.ADDED,
|
||||||
db.session.add(solicitation_report)
|
)
|
||||||
|
db.session.add(solicitation_report)
|
||||||
db.session.delete(guarantee)
|
db.session.delete(guarantee)
|
||||||
rejection_record = database.get_rejection_record(instance.id,target_instance.id)
|
rejection_record = database.get_rejection_record(instance.id,target_instance.id)
|
||||||
if rejection_record:
|
if rejection_record:
|
||||||
|
|
|
@ -162,4 +162,7 @@ class Instance(db.Model):
|
||||||
|
|
||||||
def unset_as_orphan(self):
|
def unset_as_orphan(self):
|
||||||
self.oprhan_since = None
|
self.oprhan_since = None
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
def is_claimed(self):
|
||||||
|
return len(self.admins) > 0
|
Loading…
Reference in New Issue