aboutsummaryrefslogtreecommitdiffstats
path: root/local
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2017-11-13 01:26:35 +0200
committerkongr45gpen <electrovesta@gmail.com>2017-11-13 01:26:35 +0200
commit20056690507c2a69bfdb307ae5ade414dac5a795 (patch)
tree8575544ab2346cc3eabdb5c8e87dcd3d33a62106 /local
parent1a87997aa49a8a3931525c910400bf8db141ddb7 (diff)
downloadsupybot_github-20056690507c2a69bfdb307ae5ade414dac5a795.tar.gz
supybot_github-20056690507c2a69bfdb307ae5ade414dac5a795.tar.bz2
supybot_github-20056690507c2a69bfdb307ae5ade414dac5a795.zip
Improve issues theme
Closes #10 Closes #11
Diffstat (limited to 'local')
-rw-r--r--local/theme/DefaultTheme.py18
-rw-r--r--local/utility.py9
2 files changed, 20 insertions, 7 deletions
diff --git a/local/theme/DefaultTheme.py b/local/theme/DefaultTheme.py
index d9ee11a..dbb8128 100644
--- a/local/theme/DefaultTheme.py
+++ b/local/theme/DefaultTheme.py
@@ -83,18 +83,30 @@ class DefaultTheme(Theme):
formattedActor = ircutils.bold(formattedActor)
extra = ''
+ formattedFiller = type
if action == 'assigned':
- extra = " to %s" % ircutils.bold(ircutils.mircColor(assignee, "green"))
+ if assignee == actor:
+ # Don't show assignee name twice
+ action = 'self-assigned'
+ else:
+ extra = " to %s" % ircutils.bold(ircutils.mircColor(assignee, "green"))
elif action == 'unassigned':
extra = " from %s" % ircutils.mircColor(assignee, "green")
- elif action == 'labeled' or action == 'unlabeled':
+ elif action == 'labeled':
+ # This is not the same syntax as 'unlabeled', since adding a label
+ # is a more frequent action than removing one, and adding more
+ # filler text would make the message harder to read
extra = " as %s" % ircutils.mircColor(labelName, hexToMirc(labelColor))
+ elif action == 'unlabeled':
+ # Grammar gets weird here
+ action = 'removed'
+ formattedFiller = "%s label from" % ircutils.mircColor(labelName, hexToMirc(labelColor))
self.msgs.append( "%s: %s %s %s #%s%s%s%s %s%s" % (
self.repo(),
formattedActor,
colorAction(action),
- type,
+ formattedFiller,
issueNo,
" \"%s\"" % (ircutils.bold(issueTitle)) if showName else '',
" by %s" % ircutils.mircColor(creator,"green") if creator != actor else '',
diff --git a/local/utility.py b/local/utility.py
index 86e1b91..0393ae7 100644
--- a/local/utility.py
+++ b/local/utility.py
@@ -100,9 +100,9 @@ def maxLen(msg, maxn=400, splitLines=True):
ret = msg
return ret
-
+# TODO: Use a better data structure for this?
def colorAction(action):
- """Give an action string (e.g. created, edited) and get a nice IRC colouring"""
+ """Give an action string (e.g. created, edited) and get a nice IRC colouring."""
# Fix past tense for some github verbs
if action in ["synchronize"]:
@@ -113,9 +113,10 @@ def colorAction(action):
return ircutils.bold(ircutils.mircColor(action, "green"))
if action in ["deleted", "closed", "re-tagged", "deleted tag",
"failed", "errored", "failure", "still failing",
- "broken", "error"]:
+ "broken", "error", "removed"]:
return ircutils.bold(ircutils.mircColor(action, "red"))
- if action in ["assigned", "merged", "synchronized"]:
+ if action in ["assigned", "self-assigned", "merged", "synchronized",
+ "labeled"]:
return ircutils.bold(ircutils.mircColor(action, "light blue"))
if action in ["reopened", "pending"]:
return ircutils.bold(ircutils.mircColor(action, "blue"))

© 2014-2024 Faster IT GmbH | imprint | privacy policy