Andrew Bonventre | 78792e8 | 2016-03-04 17:48:22 -0500 | [diff] [blame] | 1 | // Copyright (C) 2016 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | (function() { |
| 15 | 'use strict'; |
| 16 | |
| 17 | Polymer({ |
| 18 | is: 'gr-account-link', |
| 19 | |
| 20 | properties: { |
| 21 | account: Object, |
| 22 | avatarImageSize: { |
| 23 | type: Number, |
| 24 | value: 32, |
| 25 | }, |
| 26 | }, |
| 27 | |
Paladox none | 8b0d046 | 2017-03-31 14:37:00 +0000 | [diff] [blame] | 28 | behaviors: [ |
| 29 | Gerrit.BaseUrlBehavior, |
| 30 | ], |
| 31 | |
Kasper Nilsson | 098c5fe | 2017-05-15 15:54:56 -0700 | [diff] [blame] | 32 | _computeOwnerLink(account) { |
Andrew Bonventre | 78792e8 | 2016-03-04 17:48:22 -0500 | [diff] [blame] | 33 | if (!account) { return; } |
Logan Hanks | e6458a2 | 2017-08-11 14:41:57 -0700 | [diff] [blame] | 34 | return Gerrit.Nav.getUrlForOwner( |
Paladox none | cc5ffb2 | 2017-08-21 09:36:42 +0000 | [diff] [blame] | 35 | account.email || account.username || account.name || |
| 36 | account._account_id); |
Andrew Bonventre | 78792e8 | 2016-03-04 17:48:22 -0500 | [diff] [blame] | 37 | }, |
Kasper Nilsson | 527221a | 2016-10-07 10:07:04 -0700 | [diff] [blame] | 38 | |
Kasper Nilsson | 098c5fe | 2017-05-15 15:54:56 -0700 | [diff] [blame] | 39 | _computeShowEmail(account) { |
Kasper Nilsson | 527221a | 2016-10-07 10:07:04 -0700 | [diff] [blame] | 40 | return !!(account && !account.name); |
| 41 | }, |
Andrew Bonventre | 78792e8 | 2016-03-04 17:48:22 -0500 | [diff] [blame] | 42 | }); |
| 43 | })(); |