Browse Source

Support case title param for the stale notice.

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
d32e074089
1 changed files with 9 additions and 6 deletions
  1. +9
    -6
      earwigbot/tasks/drn_clerkbot.py

+ 9
- 6
earwigbot/tasks/drn_clerkbot.py View File

@@ -270,13 +270,14 @@ class DRNClerkBot(Task):
if len(case.body) - case.last_volunteer_size > 15000:
if case.last_action != self.STATUS_NEEDASSIST:
case.status = self.STATUS_NEEDASSIST
return self.build_talk_notice(self.STATUS_NEEDASSIST)
return self.build_talk_notice(self.STATUS_NEEDASSIST,
case.title)

timestamps = [timestamp for (editor, timestamp) in signatures]
if time() - max(timestamps) > 60 * 60 * 24 * 2:
if case.last_action != self.STATUS_STALE:
case.status = self.STATUS_STALE
return self.build_talk_notice(self.STATUS_STALE)
return self.build_talk_notice(self.STATUS_STALE, case.title)
return []

def clerk_needassist_case(self, case, volunteers, newsigs):
@@ -302,7 +303,8 @@ class DRNClerkBot(Task):
def clerk_review_case(self, case):
if time() - case.file_time > 60 * 60 * 24 * 7:
if not case.very_old_notified:
template = "{{subst:" + self.tl_notify_stale + "|zhang}} ~~~~"
template = "{{subst:" + self.tl_notify_stale + "|zhang|2="
template += case.title.replace("|", "|") + "}} ~~~~"
notice = _Notice(self.very_old_title, template)
case.very_old_notified = True
return [notice]
@@ -325,7 +327,7 @@ class DRNClerkBot(Task):
if time() - case.file_time > 60 * 60 * 24 * 4:
if case.last_action != self.STATUS_REVIEW:
case.status = self.STATUS_REVIEW
return self.build_talk_notice(self.STATUS_REVIEW)
return self.build_talk_notice(self.STATUS_REVIEW, case.title)

def read_signatures(self, text):
regex = r"\[\[(?:User(?:\stalk)?\:|Special\:Contributions\/)(.*?)(?:\||\]\]).{,256}?(\d{2}:\d{2},\s\d{2}\s\w+\s\d{4}\s\(UTC\))"
@@ -343,9 +345,10 @@ class DRNClerkBot(Task):
cursor.execute(query, (case.id,))
return cursor.fetchall()

def build_talk_notice(self, status):
def build_talk_notice(self, status, title):
param = self.ALIASES[status][0]
template = "{{subst:" + self.tl_notify_stale + "|" + param + "}} ~~~~"
template = "{{subst:" + self.tl_notify_stale + "|" + param
template += "|2=" + title.replace("|", "|") +"}} ~~~~"
return _Notice(self.talk, template)

def notify_parties(self, case):


Loading…
Cancel
Save