From b1cee3fa3bbe9e54c3ced95fa9a38caa5b3494b9 Mon Sep 17 00:00:00 2001
From: Lunny Xiao <xiaolunwen@gmail.com>
Date: Thu, 4 May 2023 15:27:15 +0800
Subject: [PATCH] Don't display creating page button in a mirror wiki
 repository (#24395)

A mirror repository with wiki is also a mirror. So creating page from UI
should be disabled. This PR hides the button like other places.
---
 options/locale/locale_en-US.ini      | 1 +
 templates/repo/settings/options.tmpl | 2 +-
 templates/repo/wiki/pages.tmpl       | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 180fd1c18d..83b978bee5 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1904,6 +1904,7 @@ settings.sync_mirror = Synchronize Now
 settings.mirror_sync_in_progress = Mirror synchronization is in progress. Check back in a minute.
 settings.site = Website
 settings.update_settings = Update Settings
+settings.update_mirror_settings = Update Mirror Settings
 settings.branches.switch_default_branch = Switch Default Branch
 settings.branches.update_default_branch = Update Default Branch
 settings.branches.add_new_rule = Add New Rule
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index 688d00bd72..cd2854c062 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -153,7 +153,7 @@
 									</div>
 									{{end}}
 									<div class="field">
-										<button class="ui green button">{{$.locale.Tr "repo.settings.update_settings"}}</button>
+										<button class="ui green button">{{$.locale.Tr "repo.settings.update_mirror_settings"}}</button>
 									</div>
 								</form>
 							</td>
diff --git a/templates/repo/wiki/pages.tmpl b/templates/repo/wiki/pages.tmpl
index 97abf9b543..6169109ce9 100644
--- a/templates/repo/wiki/pages.tmpl
+++ b/templates/repo/wiki/pages.tmpl
@@ -5,7 +5,7 @@
 		<h2 class="ui header gt-df gt-ac gt-sb">
 			<span>{{.locale.Tr "repo.wiki.pages"}}</span>
 			<span>
-				{{if and .CanWriteWiki (not .IsRepositoryMirror)}}
+				{{if and .CanWriteWiki (not .Repository.IsMirror)}}
 					<a class="ui green small button" href="{{.RepoLink}}/wiki?action=_new">{{.locale.Tr "repo.wiki.new_page_button"}}</a>
 				{{end}}
 			</span>