mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Refactor all .length === 0 patterns in JS (#30045)
				
					
				
			This pattern comes of often during review, so let's fix it once and for all. Did not test, but changes are trivial enough imho.
This commit is contained in:
		@@ -153,11 +153,11 @@ export function initRepoTopicBar() {
 | 
			
		||||
 | 
			
		||||
  $.fn.form.settings.rules.validateTopic = function (_values, regExp) {
 | 
			
		||||
    const $topics = $topicDropdown.children('a.ui.label');
 | 
			
		||||
    const status = $topics.length === 0 || $topics.last()[0].getAttribute('data-value').match(regExp);
 | 
			
		||||
    const status = !$topics.length || $topics.last()[0].getAttribute('data-value').match(regExp);
 | 
			
		||||
    if (!status) {
 | 
			
		||||
      $topics.last().removeClass('green').addClass('red');
 | 
			
		||||
    }
 | 
			
		||||
    return status && $topicDropdown.children('a.ui.label.red').length === 0;
 | 
			
		||||
    return status && !$topicDropdown.children('a.ui.label.red').length;
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  $topicForm.form({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user