Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Employ new presentation bools.
Browse files Browse the repository at this point in the history
- Fixes #17
- Fixes #18
  • Loading branch information
ralphbean committed Jun 9, 2014
1 parent 67fbd80 commit 7d039fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 11 additions & 5 deletions fmn/consumer/backends/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def _format_message(msg, recipient, config):
template = u"{title} -- {subtitle} {delta}{link}{flt}"
title = fedmsg.meta.msg2title(msg, **config)
subtitle = fedmsg.meta.msg2subtitle(msg, **config)
link = _shorten(fedmsg.meta.msg2link(msg, **config))
link = fedmsg.meta.msg2link(msg, **config)

if recipient['shorten_links']:
link = _shorten(link)

# Tack a human-readable delta on the end so users know that fmn is
# backlogged (if it is).
Expand All @@ -51,10 +54,13 @@ def _format_message(msg, recipient, config):
delta = arrow.get(msg['timestamp']).humanize() + ' '

flt = ''
if 'filter_id' in recipient:
flt_template = "{base_url}/{user}/irc/{filter_id}"
flt = " (triggered by %s)" % _shorten(flt_template.format(
base_url=config['fmn.base_url'], **recipient))
if recipient['triggered_by_links'] and 'filter_id' in recipient:
flt_template = "{base_url}{user}/irc/{filter_id}"
flt_link = flt_template.format(
base_url=config['fmn.base_url'], **recipient)
if recipient['shorten_links']:
flt_link = _shorten(flt_link)
flt = " (triggered by %s)" % flt_link

return template.format(title=title, subtitle=subtitle, delta=delta,
link=link, flt=flt)
Expand Down
2 changes: 2 additions & 0 deletions fmn/consumer/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def manage_batch(session, backend, pref):
recipients = [{
name: value.value,
'user': pref.user.openid,
'triggered_by_links': pref.triggered_by_links,
'shorten_links': pref.shorten_links,
} for value in pref.detail_values]

queued_messages = fmn.lib.models.QueuedMessage.list_for(
Expand Down

0 comments on commit 7d039fb

Please sign in to comment.