fix(ui): release: set default release title to tag name (#6883)
This fixes a regression bug introduced in the new feature added by #6645 Currently the validation will fail if you keep the default added release title. The test was changed to fail without the fix. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6883 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Beowulf <beowulf@beocode.eu> Co-committed-by: Beowulf <beowulf@beocode.eu>
This commit is contained in:
		
					parent
					
						
							
								de3e6f8a72
							
						
					
				
			
			
				commit
				
					
						b88baac7e3
					
				
			
		
					 2 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -30,8 +30,7 @@ test('External Release Attachments', async ({page, isMobile}) => {
 | 
				
			||||||
  await validate_form({page}, 'fieldset');
 | 
					  await validate_form({page}, 'fieldset');
 | 
				
			||||||
  const textarea = page.locator('input[name=tag_name]');
 | 
					  const textarea = page.locator('input[name=tag_name]');
 | 
				
			||||||
  await textarea.pressSequentially('2.0');
 | 
					  await textarea.pressSequentially('2.0');
 | 
				
			||||||
  await expect(page.locator('input[name=title]')).toHaveAttribute('placeholder', '2.0');
 | 
					  await expect(page.locator('input[name=title]')).toHaveValue('2.0');
 | 
				
			||||||
  await page.fill('input[name=title]', '2.0');
 | 
					 | 
				
			||||||
  await page.click('#add-external-link');
 | 
					  await page.click('#add-external-link');
 | 
				
			||||||
  await page.click('#add-external-link');
 | 
					  await page.click('#add-external-link');
 | 
				
			||||||
  await page.fill('input[name=attachment-new-name-2]', 'Test');
 | 
					  await page.fill('input[name=attachment-new-name-2]', 'Test');
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,7 @@ function initTagNameEditor() {
 | 
				
			||||||
  const newTagHelperText = el.getAttribute('data-tag-helper-new');
 | 
					  const newTagHelperText = el.getAttribute('data-tag-helper-new');
 | 
				
			||||||
  const existingTagHelperText = el.getAttribute('data-tag-helper-existing');
 | 
					  const existingTagHelperText = el.getAttribute('data-tag-helper-existing');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  let previousTag = '';
 | 
				
			||||||
  document.getElementById('tag-name').addEventListener('keyup', (e) => {
 | 
					  document.getElementById('tag-name').addEventListener('keyup', (e) => {
 | 
				
			||||||
    const value = e.target.value;
 | 
					    const value = e.target.value;
 | 
				
			||||||
    const tagHelper = document.getElementById('tag-helper');
 | 
					    const tagHelper = document.getElementById('tag-helper');
 | 
				
			||||||
| 
						 | 
					@ -45,7 +46,10 @@ function initTagNameEditor() {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const title_input = document.getElementById('release-title');
 | 
					    const title_input = document.getElementById('release-title');
 | 
				
			||||||
    title_input.placeholder = value;
 | 
					    if (!title_input.value || previousTag === title_input.value) {
 | 
				
			||||||
 | 
					      title_input.value = value;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    previousTag = value;
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue