summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/MozReview/Extension.pm12
-rw-r--r--template/en/default/account/prefs/apikey.html.tmpl20
2 files changed, 28 insertions, 4 deletions
diff --git a/extensions/MozReview/Extension.pm b/extensions/MozReview/Extension.pm
index e523bc2d8..1969ade42 100644
--- a/extensions/MozReview/Extension.pm
+++ b/extensions/MozReview/Extension.pm
@@ -30,6 +30,18 @@ my @METHOD_WHITELIST = (
'Bug.update_attachment',
);
+BEGIN {
+ package Bugzilla::User::APIKey;
+
+ sub is_mozreview {
+ my ($self) = @_;
+ my $mozreview_app_id = Bugzilla->params->{mozreview_app_id};
+ return 0 unless $mozreview_app_id;
+
+ return 1 if $self->app_id && $self->app_id eq $mozreview_app_id;
+ }
+}
+
sub template_before_process {
my ($self, $args) = @_;
my $file = $args->{'file'};
diff --git a/template/en/default/account/prefs/apikey.html.tmpl b/template/en/default/account/prefs/apikey.html.tmpl
index 926f3838b..cdbee848b 100644
--- a/template/en/default/account/prefs/apikey.html.tmpl
+++ b/template/en/default/account/prefs/apikey.html.tmpl
@@ -34,13 +34,25 @@ here.</p>
<th>Revoked</th>
</tr>
+ [%# because mozreview api-keys only work for the mozreview api, we hide the
+ # key and prevent renaming #%]
[% FOREACH api_key IN api_keys %]
<tr[% IF api_key.revoked %] class="apikey_revoked bz_tui_hidden" style="display:none"[% END %]>
- <td>[% api_key.api_key FILTER html %]</td>
<td>
- <input name="description_[% api_key.id FILTER html %]"
- id="description_[% api_key.id FILTER html %]"
- value="[% api_key.description FILTER html %]">
+ [% IF api_key.is_mozreview %]
+ <i>hidden</i>
+ [% ELSE %]
+ [% api_key.api_key FILTER html %]
+ [% END %]
+ </td>
+ <td>
+ [% IF api_key.is_mozreview %]
+ MozReview
+ [% ELSE %]
+ <input name="description_[% api_key.id FILTER html %]"
+ id="description_[% api_key.id FILTER html %]"
+ value="[% api_key.description FILTER html %]">
+ [% END %]
</td>
[% IF api_key.last_used %]
<td>[% api_key.last_used FILTER time %]