loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ui): hide extra PR property labels on title edit (#6898)

* hide labels [AGit](https://codeberg.org/forgejo/forgejo/pulls/2444) and [Editable](https://codeberg.org/forgejo/forgejo/pulls/6863) on title edit mode: they make layout broken and are not really needed at edit state
* make the code slightly less boring

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6898
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>

authored by

0ko
0ko
and committed by
Gusted
a6e0d3e3 90adede2

+33 -4
+1
models/fixtures/pull_request.yml
··· 64 64 base_branch: branch2 65 65 merge_base: 985f0301dba5e7b34be866819cd15ad3d8f508ee 66 66 has_merged: false 67 + allow_maintainer_edit: true 67 68 68 69 - 69 70 id: 6
+25
tests/e2e/pr-title.test.e2e.ts
··· 1 + // Copyright 2025 The Forgejo Authors. All rights reserved. 2 + // SPDX-License-Identifier: GPL-3.0-or-later 3 + 4 + // @watch start 5 + // templates/repo/issue/view_title.tmpl 6 + // web_src/js/features/repo-issue.js 7 + // @watch end 8 + 9 + import {expect} from '@playwright/test'; 10 + import {save_visual, test} from './utils_e2e.ts'; 11 + 12 + test.use({user: 'user2'}); 13 + 14 + test('PR: title edit', async ({page}) => { 15 + const response = await page.goto('/user2/repo1/pulls/5'); 16 + expect(response?.status()).toBe(200); 17 + 18 + await expect(page.locator('#editable-label')).toBeVisible(); 19 + await save_visual(page); 20 + 21 + // Labels AGit and Editable are hidden when title is in edit mode 22 + await page.locator('#issue-title-edit-show').click(); 23 + await expect(page.locator('#editable-label')).toBeHidden(); 24 + await save_visual(page); 25 + });
+7 -4
web_src/js/features/repo-issue.js
··· 631 631 632 632 const issueTitleInput = issueTitleEditor.querySelector('input'); 633 633 const oldTitle = issueTitleInput.getAttribute('data-old-title'); 634 + const normalModeElements = [issueTitleDisplay, '#pull-desc-display', '#agit-label', '#editable-label']; 634 635 issueTitleDisplay.querySelector('#issue-title-edit-show').addEventListener('click', () => { 635 - hideElem(issueTitleDisplay); 636 - hideElem('#pull-desc-display'); 636 + for (const element of normalModeElements) { 637 + hideElem(element); 638 + } 637 639 showElem(issueTitleEditor); 638 640 showElem('#pull-desc-editor'); 639 641 if (!issueTitleInput.value.trim()) { ··· 644 646 issueTitleEditor.querySelector('.ui.cancel.button').addEventListener('click', () => { 645 647 hideElem(issueTitleEditor); 646 648 hideElem('#pull-desc-editor'); 647 - showElem(issueTitleDisplay); 648 - showElem('#pull-desc-display'); 649 + for (const element of normalModeElements) { 650 + showElem(element); 651 + } 649 652 }); 650 653 651 654 const pullDescEditor = document.querySelector('#pull-desc-editor'); // it may not exist for a merged PR