Skip to content

Refactor repo-issue.ts #33784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/pull-db-tests.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -202,12 +202,10 @@ jobs:
test-mssql: test-mssql:
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
needs: files-changed needs: files-changed
# specifying the version of ubuntu in use as mssql fails on newer kernels runs-on: ubuntu-latest
# pending resolution from vendor
runs-on: ubuntu-20.04
services: services:
mssql: mssql:
image: mcr.microsoft.com/mssql/server:2017-latest image: mcr.microsoft.com/mssql/server:2019-latest
env: env:
ACCEPT_EULA: Y ACCEPT_EULA: Y
MSSQL_PID: Standard MSSQL_PID: Standard
Expand Down
2 changes: 1 addition & 1 deletion options/locale/locale_en-US.ini
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1938,7 +1938,7 @@ pulls.outdated_with_base_branch = This branch is out-of-date with the base branc
pulls.close = Close Pull Request pulls.close = Close Pull Request
pulls.closed_at = `closed this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>` pulls.closed_at = `closed this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
pulls.reopened_at = `reopened this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>` pulls.reopened_at = `reopened this pull request <a id="%[1]s" href="#%[1]s">%[2]s</a>`
pulls.cmd_instruction_hint = `View <a class="show-instruction">command line instructions</a>.` pulls.cmd_instruction_hint = View command line instructions
pulls.cmd_instruction_checkout_title = Checkout pulls.cmd_instruction_checkout_title = Checkout
pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes. pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes.
pulls.cmd_instruction_merge_title = Merge pulls.cmd_instruction_merge_title = Merge
Expand Down
39 changes: 18 additions & 21 deletions templates/repo/issue/sidebar/issue_dependencies.tmpl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
</div> </div>
<div class="item-right tw-flex tw-items-center tw-m-1"> <div class="item-right tw-flex tw-items-center tw-m-1">
{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
<a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm"
data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blocking"
data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}">
{{svg "octicon-trash" 16}} {{svg "octicon-trash" 16}}
</a> </a>
{{end}} {{end}}
Expand Down Expand Up @@ -63,7 +65,9 @@
</div> </div>
<div class="item-right tw-flex tw-items-center tw-m-1"> <div class="item-right tw-flex tw-items-center tw-m-1">
{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
<a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blockedBy" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm"
data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blockedBy"
data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}">
{{svg "octicon-trash" 16}} {{svg "octicon-trash" 16}}
</a> </a>
{{end}} {{end}}
Expand All @@ -86,7 +90,9 @@
</div> </div>
<div class="item-right tw-flex tw-items-center tw-m-1"> <div class="item-right tw-flex tw-items-center tw-m-1">
{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
<a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}"> <a class="muted show-modal" data-modal="#issue-remove-dependency-confirm"
data-modal-remove-dependency-id="{{.Issue.ID}}" data-modal-dependency-type="blocking"
data-tooltip-content="{{ctx.Locale.Tr "repo.issues.dependency.remove_info"}}">
{{svg "octicon-trash" 16}} {{svg "octicon-trash" 16}}
</a> </a>
{{end}} {{end}}
Expand All @@ -106,7 +112,7 @@
<form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm"> <form method="post" action="{{.Issue.Link}}/dependency/add" id="addDependencyForm">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<div class="ui fluid action input"> <div class="ui fluid action input">
<div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}"> <div class="ui search selection dropdown" id="new-dependency-drop-list" data-issue-id="{{.Issue.ID}}" data-issue-cross-repo-search="{{.AllowCrossRepositoryDependencies}}">
<input name="newDependency" type="hidden"> <input name="newDependency" type="hidden">
{{svg "octicon-triangle-down" 14 "dropdown icon"}} {{svg "octicon-triangle-down" 14 "dropdown icon"}}
<input type="text" class="search"> <input type="text" class="search">
Expand All @@ -122,28 +128,19 @@
</div> </div>


{{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}} {{if and .CanCreateIssueDependencies (not .Repository.IsArchived)}}
<input type="hidden" id="crossRepoSearch" value="{{.AllowCrossRepositoryDependencies}}"> <form id="issue-remove-dependency-confirm" class="ui g-modal-confirm modal" method="post" action="{{.Issue.Link}}/dependency/delete">

<div class="header">{{svg "octicon-trash"}} {{ctx.Locale.Tr "repo.issues.dependency.remove_header"}}</div>
<div class="ui g-modal-confirm modal remove-dependency">
<div class="header">
{{svg "octicon-trash"}}
{{ctx.Locale.Tr "repo.issues.dependency.remove_header"}}
</div>
<div class="content"> <div class="content">
<form method="post" action="{{.Issue.Link}}/dependency/delete" id="removeDependencyForm">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<input type="hidden" value="" name="removeDependencyID" id="removeDependencyID"> <input type="hidden" value="" name="removeDependencyID" class="remove-dependency-id">
<input type="hidden" value="" name="dependencyType" id="dependencyType"> <input type="hidden" value="" name="dependencyType" class="dependency-type">
</form> <p>
<p>{{if .Issue.IsPull}} {{ctx.Locale.Tr (Iif .Issue.IsPull "repo.issues.dependency.pr_remove_text" "repo.issues.dependency.issue_remove_text")}}
{{ctx.Locale.Tr "repo.issues.dependency.pr_remove_text"}} </p>
{{else}}
{{ctx.Locale.Tr "repo.issues.dependency.issue_remove_text"}}
{{end}}</p>
</div>
{{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}} {{$ModalButtonCancelText := ctx.Locale.Tr "repo.issues.dependency.cancel"}}
{{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}} {{$ModalButtonOkText := ctx.Locale.Tr "repo.issues.dependency.remove"}}
{{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}} {{template "base/modal_actions_confirm" (dict "." . "ModalButtonCancelText" $ModalButtonCancelText "ModalButtonOkText" $ModalButtonOkText)}}
</div> </div>
</form>
{{end}} {{end}}
{{end}} {{end}}
4 changes: 1 addition & 3 deletions templates/repo/issue/sidebar/wip_switch.tmpl
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,5 @@
{{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}} {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed) (not .IsPullWorkInProgress)}}
<div class="toggle-wip tw-mt-2" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title"> <a class="toggle-wip tw-block tw-mt-2" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title">
<a class="muted">
{{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}} {{ctx.Locale.Tr "repo.pulls.still_in_progress"}} {{ctx.Locale.Tr "repo.pulls.add_prefix" (index .PullRequestWorkInProgressPrefixes 0)}}
</a> </a>
</div>
{{end}} {{end}}
4 changes: 2 additions & 2 deletions templates/repo/issue/view_content/pull.tmpl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@
{{ctx.Locale.Tr "repo.pulls.data_broken"}} {{ctx.Locale.Tr "repo.pulls.data_broken"}}
</div> </div>
{{else if .IsPullWorkInProgress}} {{else if .IsPullWorkInProgress}}
<div class="item toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title"> <div class="item">
<div class="item-section-left flex-text-inline tw-flex-1"> <div class="item-section-left flex-text-inline tw-flex-1">
{{svg "octicon-x"}} {{svg "octicon-x"}}
{{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}} {{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}
</div> </div>
{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}} {{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}}
<button class="ui compact button"> <button class="ui compact button toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefix="{{.WorkInProgressPrefix}}" data-update-url="{{.Issue.Link}}/title">
{{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}} {{ctx.Locale.Tr "repo.pulls.remove_prefix" .WorkInProgressPrefix}}
</button> </button>
{{end}} {{end}}
Expand Down
6 changes: 4 additions & 2 deletions templates/repo/issue/view_content/pull_merge_instruction.tmpl
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="divider"></div> <div class="divider"></div>
<div class="instruct-toggle"> {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}} </div> <details>
<div class="instruct-content tw-mt-2 tw-hidden"> <summary>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}</summary>
<div class="tw-mt-2">
<div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div> <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div>
{{$localBranch := .PullRequest.HeadBranch}} {{$localBranch := .PullRequest.HeadBranch}}
{{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}
Expand Down Expand Up @@ -53,3 +54,4 @@
</div> </div>
{{end}} {{end}}
</div> </div>
</details>
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="item-section-right"> <div class="item-section-right">
{{if and $.UpdateAllowed $.UpdateByRebaseAllowed}} {{if and $.UpdateAllowed $.UpdateByRebaseAllowed}}
<div class="tw-inline-block"> <div class="tw-inline-block">
<div class="ui buttons update-button"> <div id="update-pr-branch-with-base" class="ui buttons">
<button class="ui button" data-do="{{$.Link}}/update" data-redirect="{{$.Link}}"> <button class="ui button" data-do="{{$.Link}}/update" data-redirect="{{$.Link}}">
<span class="button-text"> <span class="button-text">
{{ctx.Locale.Tr "repo.pulls.update_branch"}} {{ctx.Locale.Tr "repo.pulls.update_branch"}}
Expand Down
Loading