summaryrefslogtreecommitdiffstats
path: root/extensions/BugModal
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/BugModal')
-rw-r--r--extensions/BugModal/Extension.pm18
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl18
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/field.html.tmpl15
-rw-r--r--extensions/BugModal/template/en/default/bug_modal/user.html.tmpl5
-rw-r--r--extensions/BugModal/web/bug_modal.js3
5 files changed, 52 insertions, 7 deletions
diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm
index 3c23d0b90..c07bb4cde 100644
--- a/extensions/BugModal/Extension.pm
+++ b/extensions/BugModal/Extension.pm
@@ -175,8 +175,20 @@ sub template_before_process {
foreach my $r (@{ Bugzilla::Field->new({ name => 'resolution', cache => 1 })->legal_values }) {
my $resolution = $r->name;
next unless $resolution;
- next unless $r->is_active || $resolution eq $bug->resolution;
+ # always allow the current value
+ if ($resolution eq $bug->resolution) {
+ push @resolutions, $r;
+ next;
+ }
+
+ # never allow inactive values
+ next unless $r->is_active;
+
+ # ensure the user has basic rights to change this field
+ next unless $bug->check_can_change_field('resolution', '---', $resolution);
+
+ # canconfirm users can only set the resolution to WFM, INCOMPLETE or DUPE
if ($perms->{canconfirm}
&& !($perms->{canedit} || $perms->{isreporter}))
{
@@ -185,11 +197,15 @@ sub template_before_process {
&& $resolution ne 'INCOMPLETE'
&& $resolution ne 'DUPLICATE';
}
+
+ # reporters can set it to anything, except INCOMPELTE
if ($perms->{isreporter}
&& !($perms->{canconfirm} || $perms->{canedit}))
{
next if $resolution eq 'INCOMPLETE';
}
+
+ # expired has, uh, expired
next if $resolution eq 'EXPIRED';
push @resolutions, $r;
diff --git a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
index 024f4f6a5..e198a8706 100644
--- a/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
@@ -364,6 +364,7 @@
[% INCLUDE bug_modal/field.html.tmpl
field = bug_fields.bug_status
field_type = constants.FIELD_TYPE_SINGLE_SELECT
+ editable = bug.choices.bug_status.size > 1
values = bug.choices.bug_status
inline = 1
no_indent = 1
@@ -372,6 +373,7 @@
[% INCLUDE bug_modal/field.html.tmpl
field = bug_fields.resolution
field_type = constants.FIELD_TYPE_SINGLE_SELECT
+ editable = bug.choices.resolution.size > (bug.resolution == "" ? 0 : 1)
values = bug.choices.resolution
inline = 1
edit_only = 1
@@ -432,8 +434,12 @@
hide_on_view = bug.mentors.size == 0
%]
[%
- FOREACH mentor IN bug.mentors;
- INCLUDE bug_modal/user.html.tmpl u=mentor;
+ IF bug.mentors.size;
+ FOREACH mentor IN bug.mentors;
+ INCLUDE bug_modal/user.html.tmpl u=mentor;
+ END;
+ ELSE;
+ "---";
END;
%]
[% END %]
@@ -573,7 +579,7 @@
field_type = constants.FIELD_TYPE_KEYWORDS
hide_on_view = bug.keyword_objects.size == 0
%]
- [% bug.keyword_objects.pluck("name").join(", ") FILTER html %]
+ [% bug.keyword_objects.pluck("name").join(", ") || "---" FILTER html %]
[% END %]
[% UNLESS cf_hidden_in_product('cf_fx_iteration', bug.product, bug.component, bug) %]
@@ -828,7 +834,11 @@
[% END %]
</div>
[% END %]
- <pre id="user-story">[% bug.cf_user_story FILTER html %]</pre>
+ [% IF bug.cf_user_story == "" %]
+ ---
+ [% ELSE %]
+ <pre id="user-story">[% bug.cf_user_story FILTER html %]</pre>
+ [% END %]
[% IF user.id %]
<textarea id="cf_user_story" name="cf_user_story" style="display:none" rows="10" cols="80">
[%~ bug.cf_user_story FILTER html ~%]
diff --git a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
index cb2ce7a7a..2d2cb56cf 100644
--- a/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
@@ -52,10 +52,23 @@ END;
IF field_type == "";
field_type = -1;
END;
+# date picker fields should always be short
IF field_type == constants.FIELD_TYPE_DATE
|| field_type == constants.FIELD_TYPE_DATETIME;
short_width = 1;
END;
+# determine if a field is set
+IF field_type == constants.FIELD_TYPE_BUG_URLS || field_type == constants.FIELD_TYPE_BUG_LIST;
+ has_value = values.size > 0;
+ELSIF field_type == constants.FIELD_TYPE_MULTI_SELECT || field_type == constants.FIELD_TYPE_USERS;
+ has_value = value.size > 0;
+ELSE;
+ has_value = value != "";
+END;
+# switch to view mode if edit-only and the current user cannot edit
+IF !editable && edit_only;
+ edit_only = 0;
+END;
%]
<div class="field
@@ -78,6 +91,8 @@ END;
[% END %]
[% IF content.defined %]
[% content FILTER none %]
+ [% ELSIF !editable && !has_value %]
+ ---
[% ELSE %]
[% SWITCH field_type %]
diff --git a/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl b/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl
index 718eb5e79..4f312e654 100644
--- a/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl
+++ b/extensions/BugModal/template/en/default/bug_modal/user.html.tmpl
@@ -15,7 +15,10 @@
#%]
[%
-RETURN UNLESS u.id;
+IF !u.id;
+ "---";
+ RETURN;
+END;
DEFAULT gravatar_size = 0;
IF user.settings.show_gravatars.value != 'On';
gravatar_size = 0;
diff --git a/extensions/BugModal/web/bug_modal.js b/extensions/BugModal/web/bug_modal.js
index ec53c32c2..46050a72a 100644
--- a/extensions/BugModal/web/bug_modal.js
+++ b/extensions/BugModal/web/bug_modal.js
@@ -413,7 +413,8 @@ $(function() {
.change();
$('#resolution')
.change(function(event) {
- if (event.target.value == "DUPLICATE") {
+ var bug_status = $('#bug_status').val();
+ if ((bug_status == "RESOLVED" || bug_status == "VERIFIED") && event.target.value == "DUPLICATE") {
$('#duplicate-container').show();
$('#mark-as-dup-btn').hide();
$('#dup_id').focus();