Skip to content

Commit a80a2e0

Browse files
authored
Merge branch 'main' into patch-20
2 parents cfde7fe + a175f98 commit a80a2e0

33 files changed

+180
-148
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ rules:
642642
no-this-before-super: [2]
643643
no-throw-literal: [2]
644644
no-undef-init: [2]
645-
no-undef: [2, {typeof: true}]
645+
no-undef: [2, {typeof: true}] # TODO: disable this rule after tsc passes
646646
no-undefined: [0]
647647
no-underscore-dangle: [0]
648648
no-unexpected-multiline: [2]

routers/web/repo/pull.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
348348
}
349349

350350
if !baseGitRepo.IsBranchExist(pull.BaseBranch) {
351+
ctx.Data["BaseBranchNotExist"] = true
351352
ctx.Data["IsPullRequestBroken"] = true
352353
ctx.Data["BaseTarget"] = pull.BaseBranch
353354
ctx.Data["HeadTarget"] = pull.HeadBranch

templates/repo/issue/sidebar/milestone_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
</a>
3939
{{end}}
4040
{{end}}
41+
</div>
4142
{{end}}
42-
</div>
4343
</div>
4444
</div>
4545

templates/repo/issue/view_content/comments.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@
231231
{{template "shared/user/avatarlink" dict "user" .Poster}}
232232
<span class="text grey muted-links">
233233
{{template "shared/user/authorlink" .Poster}}
234-
{{ctx.Locale.Tr "repo.issues.delete_branch_at" .OldRef $createdStr}}
234+
{{$oldRef := HTMLFormat `<span class="tw-line-through">%s</span>` .OldRef}}
235+
{{ctx.Locale.Tr "repo.issues.delete_branch_at" $oldRef $createdStr}}
235236
</span>
236237
</div>
237238
{{else if eq .Type 12}}

templates/repo/issue/view_title.tmpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@
6161
{{if .Issue.PullRequest.IsAgitFlow}}
6262
{{$headHref = HTMLFormat `%s <a href="%s" target="_blank"><span class="ui label basic tiny" data-tooltip-content="%s">AGit</span></a>` $headHref "https://docs.gitea.com/usage/agit" (ctx.Locale.Tr "repo.pull.agit_documentation")}}
6363
{{else}}
64-
{{$headHref = HTMLFormat `<span data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $headHref}}
64+
{{$headHref = HTMLFormat `<span class="tw-line-through" data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $headHref}}
6565
{{end}}
6666
{{end}}
6767
{{$baseHref := .BaseTarget}}
6868
{{if .BaseBranchLink}}
69-
{{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}}
69+
{{if .BaseBranchNotExist}}
70+
{{$baseHref = HTMLFormat `<span class="tw-line-through" data-tooltip-content="%s">%s</span>` (ctx.Locale.Tr "form.target_branch_not_exist") $baseHref}}
71+
{{else}}
72+
{{$baseHref = HTMLFormat `<a href="%s">%s</a>` .BaseBranchLink $baseHref}}
73+
{{end}}
7074
{{end}}
7175
{{if .Issue.PullRequest.HasMerged}}
7276
{{$mergedStr:= DateUtils.TimeSince .Issue.PullRequest.MergedUnix}}

tests/integration/pull_merge_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,8 @@ func TestPullDontRetargetChildOnWrongRepo(t *testing.T) {
589589
resp := session.MakeRequest(t, req, http.StatusOK)
590590

591591
htmlDoc := NewHTMLParser(t, resp.Body)
592-
targetBranch := htmlDoc.doc.Find("#branch_target>a").Text()
592+
// the branch has been deleted, so there is no a html tag instead of span
593+
targetBranch := htmlDoc.doc.Find("#branch_target>span").Text()
593594
prStatus := strings.TrimSpace(htmlDoc.doc.Find(".issue-title-meta>.issue-state-label").Text())
594595

595596
assert.EqualValues(t, "base-pr", targetBranch)

web_src/js/features/autofocus-end.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export function initAutoFocusEnd() {
2-
for (const el of document.querySelectorAll('.js-autofocus-end')) {
2+
for (const el of document.querySelectorAll<HTMLInputElement>('.js-autofocus-end')) {
33
el.focus(); // expects only one such element on one page. If there are many, then the last one gets the focus.
44
el.setSelectionRange(el.value.length, el.value.length);
55
}

web_src/js/features/captcha.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ export async function initCaptcha() {
3535
}
3636
case 'm-captcha': {
3737
const {default: mCaptcha} = await import(/* webpackChunkName: "mcaptcha-vanilla-glue" */'@mcaptcha/vanilla-glue');
38+
// @ts-expect-error
3839
mCaptcha.INPUT_NAME = 'm-captcha-response';
3940
const instanceURL = captchaEl.getAttribute('data-instance-url');
4041

42+
// @ts-expect-error
4143
mCaptcha.default({
4244
siteKey: {
4345
instanceUrl: new URL(instanceURL),

web_src/js/features/citation.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {fomanticQuery} from '../modules/fomantic/base.ts';
33

44
const {pageData} = window.config;
55

6-
async function initInputCitationValue(citationCopyApa, citationCopyBibtex) {
6+
async function initInputCitationValue(citationCopyApa: HTMLButtonElement, citationCopyBibtex: HTMLButtonElement) {
77
const [{Cite, plugins}] = await Promise.all([
88
import(/* webpackChunkName: "citation-js-core" */'@citation-js/core'),
99
import(/* webpackChunkName: "citation-js-formats" */'@citation-js/plugin-software-formats'),
@@ -27,9 +27,9 @@ export async function initCitationFileCopyContent() {
2727

2828
if (!pageData.citationFileContent) return;
2929

30-
const citationCopyApa = document.querySelector('#citation-copy-apa');
31-
const citationCopyBibtex = document.querySelector('#citation-copy-bibtex');
32-
const inputContent = document.querySelector('#citation-copy-content');
30+
const citationCopyApa = document.querySelector<HTMLButtonElement>('#citation-copy-apa');
31+
const citationCopyBibtex = document.querySelector<HTMLButtonElement>('#citation-copy-bibtex');
32+
const inputContent = document.querySelector<HTMLInputElement>('#citation-copy-content');
3333

3434
if ((!citationCopyApa && !citationCopyBibtex) || !inputContent) return;
3535

@@ -41,7 +41,7 @@ export async function initCitationFileCopyContent() {
4141
citationCopyApa.classList.toggle('primary', !isBibtex);
4242
};
4343

44-
document.querySelector('#cite-repo-button')?.addEventListener('click', async (e) => {
44+
document.querySelector('#cite-repo-button')?.addEventListener('click', async (e: MouseEvent & {target: HTMLAnchorElement}) => {
4545
const dropdownBtn = e.target.closest('.ui.dropdown.button');
4646
dropdownBtn.classList.add('is-loading');
4747

web_src/js/features/clipboard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ const {copy_success, copy_error} = window.config.i18n;
99
// - data-clipboard-target: Holds a selector for a <input> or <textarea> whose content is copied
1010
// - data-clipboard-text-type: When set to 'url' will convert relative to absolute urls
1111
export function initGlobalCopyToClipboardListener() {
12-
document.addEventListener('click', async (e) => {
12+
document.addEventListener('click', async (e: MouseEvent & {target: HTMLElement}) => {
1313
const target = e.target.closest('[data-clipboard-text], [data-clipboard-target]');
1414
if (!target) return;
1515

1616
e.preventDefault();
1717

1818
let text = target.getAttribute('data-clipboard-text');
1919
if (!text) {
20-
text = document.querySelector(target.getAttribute('data-clipboard-target'))?.value;
20+
text = document.querySelector<HTMLInputElement>(target.getAttribute('data-clipboard-target'))?.value;
2121
}
2222

2323
if (text && target.getAttribute('data-clipboard-text-type') === 'url') {

0 commit comments

Comments
 (0)