Files
gerrit/polygerrit-ui/app/elements/shared/gr-account-chip/gr-account-chip.js
Kasper Nilsson f0f5740bc8 Allow for deletion of votes from changes
Adds UI to allow reviewers to remove a user's vote on a commit if they
are logged in and have the proper permissions from the backend.

Bug: Issue 4663
Change-Id: Idff3ee1d242acdd4883fe3f28c7794b7c4c9ddf1
2016-10-03 17:50:18 -07:00

59 lines
1.5 KiB
JavaScript

// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
(function() {
'use strict';
Polymer({
is: 'gr-account-chip',
properties: {
account: Object,
removable: {
type: Boolean,
value: false,
},
showAvatar: {
type: Boolean,
reflectToAttribute: true,
},
transparentBackground: {
type: Boolean,
value: false,
},
},
ready: function() {
this._getHasAvatars().then(function(hasAvatars) {
this.showAvatar = hasAvatars;
}.bind(this));
},
_getBackgroundClass: function(transparent) {
return transparent ? 'transparentBackground' : '';
},
_handleRemoveTap: function(e) {
e.preventDefault();
this.fire('remove', {account: this.account});
},
_getHasAvatars: function() {
return this.$.restAPI.getConfig().then(function(cfg) {
return Promise.resolve(!!(cfg && cfg.plugin && cfg.plugin.has_avatars));
});
},
});
})();