Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the bodhi "alias" instead of "title" if available. #253

Merged
merged 1 commit into from Apr 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 12 additions & 6 deletions fedmsg_meta_fedora_infrastructure/bodhi.py
Expand Up @@ -78,6 +78,12 @@ def _u2p(self, update):
# package name (and not just the update name) to begin with.
return [build.rsplit('-', 2)[0] for build in update.split(',')]

def title_or_alias(self, msg):
value = msg['msg']['update'].get('alias')
if not value:
value = msg['msg']['update']['title']
return value

def secondary_icon(self, msg, **config):
username = ''
if 'bodhi.update.comment' in msg['topic']:
Expand Down Expand Up @@ -269,17 +275,17 @@ def link(self, msg, **config):
if 'bodhi.update.comment' in msg['topic']:
return tmpl.format(title=msg['msg']['comment']['update_title'])
elif 'bodhi.update.complete' in msg['topic']:
return tmpl.format(title=msg['msg']['update']['title'])
return tmpl.format(title=self.title_or_alias(msg))
elif 'bodhi.update.request' in msg['topic']:
return tmpl.format(title=msg['msg']['update']['title'])
return tmpl.format(title=self.title_or_alias(msg))
elif 'bodhi.update.edit' in msg['topic']:
return tmpl.format(title=msg['msg']['update']['title'])
return tmpl.format(title=self.title_or_alias(msg))
elif 'bodhi.update.eject' in msg['topic']:
return tmpl.format(title=msg['msg']['update']['title'])
return tmpl.format(title=self.title_or_alias(msg))
elif 'bodhi.update.karma.threshold' in msg['topic']:
return tmpl.format(title=msg['msg']['update']['title'])
return tmpl.format(title=self.title_or_alias(msg))
elif 'bodhi.errata.publish' in msg['topic']:
return tmpl.format(title=msg['msg']['update']['title'])
return tmpl.format(title=self.title_or_alias(msg))
elif 'bodhi.stack' in msg['topic']:
return prefix + "/updates/stacks/{title}".format(
title=msg['msg']['stack']['name'])
Expand Down
4 changes: 2 additions & 2 deletions fedmsg_meta_fedora_infrastructure/tests/bodhi.py
Expand Up @@ -1008,7 +1008,7 @@ class TestBodhiKarmaThresholdStable(Base):
expected_title = "bodhi.update.karma.threshold"
expected_subti = "tzdata-2014i-1.fc19 reached the stable karma threshold"
expected_link = "https://admin.fedoraproject.org/updates/" + \
"tzdata-2014i-1.fc19"
"FEDORA-EPEL-2015-0238"
expected_icon = "https://admin.fedoraproject.org/updates" + \
"/static/images/bodhi-icon-48.png"
expected_secondary_icon = "https://apps.fedoraproject.org/packages/" + \
Expand Down Expand Up @@ -1092,7 +1092,7 @@ class TestBodhiKarmaThresholdStable(Base):
"notes": "the update notes go here...",
"request": "testing",
"bugs": [],
"alias": None,
"alias": "FEDORA-EPEL-2015-0238",
"karma": 0,
"release": {
"dist_tag": "f19",
Expand Down