]> source.dussan.org Git - gitea.git/commitdiff
Hide `last indexed SHA` when a repo could not be indexed yet (#26340) (#26345)
authorGiteabot <teabot@gitea.io>
Sat, 5 Aug 2023 16:08:17 +0000 (00:08 +0800)
committerGitHub <noreply@github.com>
Sat, 5 Aug 2023 16:08:17 +0000 (16:08 +0000)
Backport #26340 by @CaiCandong

Now, for a new repo without any commit, the Last indexed SHA field looks
like this:
Before:

![image](https://github.com/go-gitea/gitea/assets/50507092/cecc6e24-3366-4093-ae07-c361ea34b373)
After:

![image](https://github.com/go-gitea/gitea/assets/50507092/9b6ba703-b0d5-4648-ad6b-9a2341dd60f9)

fix #26336

Co-authored-by: CaiCandong <50507092+CaiCandong@users.noreply.github.com>
templates/repo/settings/options.tmpl

index 1e940c581b3eb86e5cdf59af043bb5ed03a6f174..f1ce48e871abeea0744842270dda51541da2ab42 100644 (file)
                                {{end}}
                                <h4 class="ui header">{{.locale.Tr "repo.settings.admin_stats_indexer"}}</h4>
                                <div class="inline fields">
-                                       <label>{{.locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
+                                       {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
+                                               <label>{{.locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
+                                       {{end}}
                                        <span class="field">
-                                               {{if .StatsIndexerStatus}}
+                                               {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
                                                        <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.StatsIndexerStatus.CommitSha}}">
                                                                <span class="shortsha">{{ShortSha .StatsIndexerStatus.CommitSha}}</span>
                                                        </a>