If a user had no name then it would show up blank in the reviewers table when searching it would bring up undefined <undefined>. This change fixes it by using a fallback name. Change-Id: I403a35b1b72280c9928c63139725f73ef46cf3fd
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!--
 | 
						|
Copyright (C) 2017 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.
 | 
						|
-->
 | 
						|
 | 
						|
<script>
 | 
						|
(function(window) {
 | 
						|
  'use strict';
 | 
						|
 | 
						|
  const ANONYMOUS_NAME = 'Anonymous';
 | 
						|
 | 
						|
  window.Gerrit = window.Gerrit || {};
 | 
						|
 | 
						|
  /** @polymerBehavior Gerrit.AnonymousNameBehavior */
 | 
						|
  Gerrit.AnonymousNameBehavior = {
 | 
						|
    /**
 | 
						|
     * enableEmail when true enables to fallback to using email if
 | 
						|
     * the account name is not avilable.
 | 
						|
     */
 | 
						|
    getUserName(config, account, enableEmail) {
 | 
						|
      if (account && account.name) {
 | 
						|
        return account.name;
 | 
						|
      } else if (enableEmail && account && account.email) {
 | 
						|
        return account.email;
 | 
						|
      } else if (config && config.user &&
 | 
						|
          config.user.anonymous_coward_name !== 'Anonymous Coward') {
 | 
						|
        return config.user.anonymous_coward_name;
 | 
						|
      }
 | 
						|
 | 
						|
      return ANONYMOUS_NAME;
 | 
						|
    },
 | 
						|
  };
 | 
						|
})(window);
 | 
						|
</script>
 |