From 70b0c30def12a06c4afda593ebebb523b04d4604 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sat, 13 Apr 2024 16:49:44 +0800 Subject: [PATCH] Fix admin notice view-detail (#30450) (#30458) Backport #30450 by @silverwind Fix https://github.com/go-gitea/gitea/issues/30434, regression from https://github.com/go-gitea/gitea/pull/30115. I also removed the date insertion into the modal which was also broken since that date was switched to `absolute-date` because I see no real purpose to putting that date into the modal. Result: image Co-authored-by: silverwind (cherry picked from commit fd2184e2343842e158f5b12e3d2e5b88effea2fd) --- templates/admin/notice.tmpl | 5 +---- web_src/js/features/admin/common.js | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/templates/admin/notice.tmpl b/templates/admin/notice.tmpl index 5ea003e5ec..33d8a2f963 100644 --- a/templates/admin/notice.tmpl +++ b/templates/admin/notice.tmpl @@ -62,10 +62,7 @@ {{template "admin/layout_footer" .}} diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index f388b1122e..b35502d52f 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -207,13 +207,13 @@ export function initAdminCommon() { // Notice if (document.querySelector('.admin.notice')) { - const $detailModal = document.getElementById('detail-modal'); + const detailModal = document.getElementById('detail-modal'); // Attach view detail modals $('.view-detail').on('click', function () { - $detailModal.find('.content pre').text($(this).parents('tr').find('.notice-description').text()); - $detailModal.find('.sub.header').text(this.closest('tr')?.querySelector('relative-time')?.getAttribute('title')); - $detailModal.modal('show'); + const description = this.closest('tr').querySelector('.notice-description').textContent; + detailModal.querySelector('.content pre').textContent = description; + $(detailModal).modal('show'); return false; });