summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BMO/Extension.pm16
-rw-r--r--extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl57
2 files changed, 69 insertions, 4 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 0e43830ee..62f88287a 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -45,9 +45,10 @@ use Email::MIME::ContentType qw(parse_content_type);
use Encode qw(find_encoding encode_utf8);
use File::MimeInfo::Magic;
use List::MoreUtils qw(natatime);
-use Scalar::Util qw(blessed);
use List::Util qw(first);
+use Scalar::Util qw(blessed);
use Sys::Syslog qw(:DEFAULT setlogsock);
+use Text::Balanced qw( extract_bracketed extract_multiple );
use Bugzilla::Extension::BMO::Constants;
use Bugzilla::Extension::BMO::FakeBug;
@@ -130,6 +131,9 @@ sub template_before_process {
$vars->{'versions'} = [ reverse @$versions ];
}
}
+ elsif ($file eq 'bug/edit.html.tmpl') {
+ $vars->{split_cf_crash_signature} = $self->_split_crash_signature($vars);
+ }
if ($file =~ /^list\/list/ || $file =~ /^bug\/create\/create[\.-]/) {
@@ -1860,4 +1864,14 @@ sub bug_comments {
}
}
+sub _split_crash_signature {
+ my ($self, $vars) = @_;
+ my $bug = $vars->{bug} // return;
+ my $crash_signature = $bug->cf_crash_signature // return;
+ return [
+ grep { /\S/ }
+ extract_multiple($crash_signature, [ sub { extract_bracketed($_[0], '[]') } ])
+ ];
+}
+
__PACKAGE__->NAME;
diff --git a/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl b/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
index 6e871f731..c11e6ea42 100644
--- a/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/bug/edit-custom_field.html.tmpl
@@ -6,6 +6,57 @@
# defined by the Mozilla Public License, v. 2.0.
#%]
-[% IF field.name == 'cf_rank' %]
- [% field.hidden = 1 %]
-[% END %]
+[%
+ IF field.name == 'cf_rank';
+ field.hidden = 1;
+ RETURN;
+ END;
+%]
+
+[%
+ IF field.name == 'cf_crash_signature';
+ field.hidden = 1;
+ value = bug.cf_crash_signature;
+%]
+ [%# lifted from bug/field.html.tmpl %]
+ <tr>
+ [% PROCESS "bug/field-label.html.tmpl" %]
+ <td class="field_value" id="field_container_[% field.name FILTER html %]" colspan="2">
+ <div id="[% field.name FILTER html %]_edit_container" class="bz_default_hidden">
+ <div>
+ (<a href="#" id="[% field.name FILTER html %]_edit_action">edit</a>)
+ </div>
+ [% IF split_cf_crash_signature.size %]
+ [% FOREACH sig = split_cf_crash_signature %]
+ [% IF sig.match('^\[\@\s*') && sig.match('\s*\]$') %]
+ [% sig = sig.replace('(^\[\@\s*|\s*\]$)', '') %]
+ <a href="https://crash-stats.mozilla.com/report/list?signature=[% sig FILTER uri %]"
+ target="_blank">[@ [% sig FILTER html %] ]</a><br>
+ [% ELSE %]
+ [% sig FILTER html %]<br>
+ [% END %]
+ [% END %]
+ [% ELSIF value %]
+ <pre class="field_textarea_readonly">[% value FILTER html %]</pre>
+ [% END %]
+ </div>
+ <div id="[% field.name FILTER html %]_input">
+ [% INCLUDE global/textarea.html.tmpl
+ id = field.name name = field.name minrows = 4 maxrows = 8
+ cols = 60 defaultcontent = value %]
+ </div>
+ <script type="text/javascript">
+ hideEditableField('[% field.name FILTER js %]_edit_container',
+ '[% field.name FILTER js %]_input',
+ '[% field.name FILTER js %]_edit_action',
+ '[% field.name FILTER js %]',
+ '[% value FILTER js %]',
+ '',
+ true);
+ </script>
+ </td>
+ </tr>
+[%
+ RETURN;
+ END;
+%]