catlee/treestatus — pull request #28 by graememcc (2012-09-07 13:19:37+00:00)
Title: Automatically transform "bug XXXXXX" into a b.m.o link in JSON output

I'm sure I remember seeing edmorley wish for this, though I don't remember where!

"bug XXXXXX" will only be transformed if it does not appear to be already part of a link: I'm using a fairly simple heuristic of looking for a closing tag following the bug number, but I think this should be sufficient for our purposes.

This only affects the JSON output. If "bug XXXXXX" was expanded in all cases - e.g. by sticking the relevant code into Status.get_tree(s) - then if we pre-fill the fields per issue 22, on submission the sheriff may find the field unexpectedly truncated as the form submission would then include the full link text (76 characters). The only alternative would be to strip out any Bugzilla links from the reason and motd fields prior to being stored in the DB - that seemed needlessly invasive.