fix(ui): make Finish review button work again (#6818)

I bricked the Finish review button in https://codeberg.org/forgejo/forgejo/pulls/6729 because I was naive and thought there are no mines laid within JS. I was wrong, because review panel was expected to be a child of review button. I switched both selectors to context of reviewBox.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6818
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
0ko 2025-02-07 10:01:09 +00:00 committed by Gusted
parent 2645c0824f
commit b7065b7748
2 changed files with 27 additions and 2 deletions

View file

@ -0,0 +1,25 @@
// Copyright 2025 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
// @watch start
// templates/repo/diff/new_review.tmpl
// web_src/js/features/repo-issue.js
// @watch end
import {expect} from '@playwright/test';
import {save_visual, test} from './utils_e2e.ts';
test.use({user: 'user2'});
test('PR: Finish review', async ({page}) => {
const response = await page.goto('/user2/repo1/pulls/5/files');
expect(response?.status()).toBe(200);
await expect(page.locator('.tippy-box .review-box-panel')).toBeHidden();
await save_visual(page);
// Review panel should appear after clicking Finish review
await page.locator('#review-box .js-btn-review').click();
await expect(page.locator('.tippy-box .review-box-panel')).toBeVisible();
await save_visual(page);
});

View file

@ -517,8 +517,8 @@ export function initRepoPullRequestReview() {
// The following part is only for diff views
if (!$('.repository.pull.diff').length) return;
const $reviewBtn = $('.js-btn-review');
const $panel = $reviewBtn.parent().find('.review-box-panel');
const $reviewBtn = $reviewBox.parent().find('.js-btn-review');
const $panel = $reviewBox.parent().find('.review-box-panel');
const $closeBtn = $panel.find('.close');
if ($reviewBtn.length && $panel.length) {