=back
+=head2 search_timestamp_translate
+
+This happens in L<Bugzilla::Search/_timestamp_translate> and allows you to
+support pronouns for specific dates, such as a product release date. Check the
+`value` argument and replace it with actual date where needed.
+
+Params:
+
+=over
+
+=item C<search> - The L<Bugzilla::Search> object.
+
+=item C<args> - The original arguments including C<value>.
+
+=back
+
=head2 search_operator_field_override
This allows you to modify L<Bugzilla::Search/OPERATOR_FIELD_OVERRIDE>,
my $value = $args->{value};
my $dbh = Bugzilla->dbh;
+ # Allow to support custom date pronouns
+ Bugzilla::Hook::process('search_timestamp_translate',
+ {search => $self, args => $args});
+
return if $value !~ /^(?:[\+\-]?\d+[hdwmy]s?|now)$/i;
$value = SqlifyDate($value);
# Replace keys
if ($key =~ $flag_re) {
my ($canonical, $alias) = _get_search_param_name($1, $2, $3);
- ThrowUserError('product_versions_unavailable') unless $canonical;
+ ThrowUserError('product_version_pronouns_unavailable') unless $canonical;
$params->{$canonical} = delete $params->{$key};
}
# Replace values (custom search)
if ($params->{$key} =~ $flag_re) {
my ($canonical, $alias) = _get_search_param_name($1, $2, $3);
- ThrowUserError('product_versions_unavailable') unless $canonical;
+ ThrowUserError('product_version_pronouns_unavailable') unless $canonical;
$params->{$key} = $canonical;
}
}
}
+# Allow to use Firefox release date pronouns, including `%LAST_MERGE_DATE%`,
+# `%LAST_RELEASE_DATE%` and `%LAST_SOFTFREEZE_DATE%`.
+sub search_timestamp_translate {
+ my ($self, $args) = @_;
+ $args = $args->{args};
+ my $key = uc($args->{value});
+ $key =~ s/^%([A-Z_]+)%$/$1/;
+ my $keys = ['LAST_MERGE_DATE', 'LAST_RELEASE_DATE', 'LAST_SOFTFREEZE_DATE'];
+ return unless grep(/^$key$/, @$keys);
+
+ my $date = _fetch_product_version_file('firefox')->{$key};
+ ThrowUserError('product_date_pronouns_unavailable') unless $date;
+ $args->{value} = $date;
+ $args->{quoted} = Bugzilla->dbh->quote($date);
+}
+
sub tf_buglist_columns {
my ($self, $args) = @_;
my $columns = $args->{columns};
You cannot set this [% terms.bug %]'s status to ASSIGNED because the
[%+ terms.bug %] is not assigned to a person.
-[% ELSIF error == "product_versions_unavailable" %]
- [% title = "Product Version Info Unavailable" %]
+[% ELSIF error == "product_version_pronouns_unavailable" %]
+ [% title = "Product Version Pronouns Unavailable" %]
The pronouns for Status and Tracking Flags cannot be used at this time.
Please try again later or use actual version numbers instead.
+[% ELSIF error == "product_date_pronouns_unavailable" %]
+ [% title = "Product Date Pronouns Unavailable" %]
+ The pronoun for the merge date and release date cannot be used at this time.
+ Please try again later or use actual dates instead.
+
[% END %]