humbug_trac: Update display of field changes.

(imported from commit 20253fb28273d80a5d8f69b1fd60545c2fb545bb)
This commit is contained in:
Tim Abbott 2012-10-24 18:18:44 -04:00
parent 5955b6fc55
commit 4616108fc7

View file

@ -62,12 +62,16 @@ class HelloWorldPlugin(Component):
""" """
content = "%s updated %s:\n\n" % (author, markdown_ticket_url(ticket)) content = "%s updated %s:\n\n" % (author, markdown_ticket_url(ticket))
for key in old_values.keys(): for key in old_values.keys():
if key != "description": if key == "description":
content += '- Changed %s from "%s" to "%s"\n' % (key, old_values.get(key),
ticket.values.get(key))
else:
content += '- Changed %s from %s to %s' % (key, markdown_block(old_values.get(key)), content += '- Changed %s from %s to %s' % (key, markdown_block(old_values.get(key)),
markdown_block(ticket.values.get(key))) markdown_block(ticket.values.get(key)))
elif old_values.get(key) == "":
content += '- Added %s **%s**\n' % (key, ticket.values.get(key))
elif ticket.values.get(key) == "":
content += '- Remove %s **%s**\n' % (key, old_values.get(key))
else:
content += '- Changed %s from **%s** to **%s**\n' % (key, old_values.get(key),
ticket.values.get(key))
if comment: if comment:
content += '- Added a comment: %s' % (markdown_block(comment,)) content += '- Added a comment: %s' % (markdown_block(comment,))