File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 11import $ from 'jquery' ;
2+ import { checkAppUrl } from '../common-global.js' ;
23
34const { csrfToken} = window . config ;
45
56export function initAdminCommon ( ) {
6- if ( $ ( '.admin' ) . length === 0 ) {
7+ if ( $ ( '.page-content. admin' ) . length === 0 ) {
78 return ;
89 }
910
11+ // check whether appUrl(ROOT_URL) is correct, if not, show an error message
12+ // only admin pages need this check because most templates are using relative URLs now
13+ checkAppUrl ( ) ;
14+
1015 // New user
1116 if ( $ ( '.admin.new.user' ) . length > 0 || $ ( '.admin.edit.user' ) . length > 0 ) {
1217 $ ( '#login_type' ) . on ( 'change' , function ( ) {
Original file line number Diff line number Diff line change @@ -381,9 +381,6 @@ export function checkAppUrl() {
381381 if ( curUrl . startsWith ( appUrl ) || `${ curUrl } /` === appUrl ) {
382382 return ;
383383 }
384- if ( document . querySelector ( '.page-content.install' ) ) {
385- return ; // no need to show the message on the installation page
386- }
387- showGlobalErrorMessage ( `Your ROOT_URL in app.ini is ${ appUrl } but you are visiting ${ curUrl }
388- You should set ROOT_URL correctly, otherwise the web may not work correctly.` ) ;
384+ showGlobalErrorMessage ( `Your ROOT_URL in app.ini is "${ appUrl } ", it's unlikely matching the site you are visiting.
385+ Mismatched ROOT_URL config causes wrong URL links for web UI/mail content/webhook notification.` ) ;
389386}
Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ import {
4848 initCommitStatuses ,
4949} from './features/repo-commit.js' ;
5050import {
51- checkAppUrl ,
5251 initFootLanguageMenu ,
5352 initGlobalButtonClickOnEnter ,
5453 initGlobalButtons ,
@@ -199,5 +198,4 @@ $(document).ready(() => {
199198 initUserAuthWebAuthnRegister ( ) ;
200199 initUserSettings ( ) ;
201200 initViewedCheckboxListenerFor ( ) ;
202- checkAppUrl ( ) ;
203201} ) ;
You can’t perform that action at this time.
0 commit comments