in src/olympia/abuse/models.py [0:0]
def can_be_appealed(self, *, is_reporter, abuse_report=None):
"""
Whether or not the decision can be appealed.
"""
now = datetime.now()
base_criteria = (
self.action_date
and self.action_date >= now - timedelta(days=APPEAL_EXPIRATION_DAYS)
# Can never appeal an original decision that has been appealed and
# for which we already have a new decision. In some cases the
# appealed decision (new decision id) can be appealed by the author
# though (see below).
and not self.appealed_decision_already_made()
# if a decision has been overriden, the appeal must be on the overide
and not hasattr(self, 'overridden_by')
)
user_criteria = (
# Reporters can appeal decisions if they have a report and that
# report has no appeals yet (the decision itself might already be
# appealed - it can have multiple reporters). Note that we're only
# attaching the abuse report to the original job, not the appeal,
# by design.
(
is_reporter
and abuse_report
and self.is_third_party_initiated
and abuse_report.cinder_job == self.cinder_job
and not hasattr(abuse_report, 'cinderappeal')
and self.action in DECISION_ACTIONS.APPEALABLE_BY_REPORTER
)
or
# Authors can appeal decisions not already appealed. Note that the
# decision they are appealing might be a new decision following
# an appeal from a reporter who disagreed with our initial decision
# to keep the content up (always leaving a chance for the author
# to be notified and appeal a decision against them, even if they
# were not notified of an initial decision favorable to them).
(
not is_reporter
and not self.appeal_job
and self.action in DECISION_ACTIONS.APPEALABLE_BY_AUTHOR
)
)
return base_criteria and user_criteria