Skip to content
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

link to file from its history #27354

Merged
merged 10 commits into from
Oct 2, 2023
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ locked = Locked

copy = Copy
copy_url = Copy URL
copy_hash = Copy hash
copy_content = Copy content
copy_branch = Copy branch name
copy_success = Copied!
Expand Down Expand Up @@ -1283,6 +1284,7 @@ commits.signed_by_untrusted_user = Signed by untrusted user
commits.signed_by_untrusted_user_unmatched = Signed by untrusted user who does not match committer
commits.gpg_key_id = GPG Key ID
commits.ssh_key_fingerprint = SSH Key Fingerprint
commits.view_path=View at this point in history
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a ini linter, I would make it lint for spaces around = 😆


commit.operations = Operations
commit.revert = Revert
Expand Down
10 changes: 8 additions & 2 deletions templates/repo/commits_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
<tr>
<th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th>
<th class="two wide sha">SHA1</th>
<th class="nine wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
<th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
<th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th>
<th class="one wide right aligned"></th>
</tr>
</thead>
<tbody class="commit-list">
Expand All @@ -25,7 +26,6 @@
{{end}}
</td>
<td class="sha gt-df">
<button class="ui button copy-commit-sha gt-df gt-ac" data-clipboard-text="{{.ID}}">{{svg "octicon-copy" 14}}</button>
{{$class := "ui sha label"}}
{{if .Signature}}
{{$class = (print $class " isSigned")}}
Expand Down Expand Up @@ -76,6 +76,12 @@
{{else}}
<td class="text right aligned">{{TimeSince .Author.When ctx.Locale}}</td>
{{end}}
<td class="gt-pt-0 gt-pb-0">
<div class="gt-df gt-je">
<button class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
{{if $.FileName}}<a class="btn interact-bg gt-p-3" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{printf "%s/src/commit/%s/%s" $commitRepoLink (PathEscape .ID.String) $.FileName}}">{{svg "octicon-file-code"}}</a>{{end}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think $.FileName needs to be escaped to URL parameter. Otherwise C++ or C# breaks the URL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, likely PathEscape.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-> Improve file history UI and fix URL escaping bug #27531

</div>
</td>
</tr>
{{end}}
</tbody>
Expand Down
7 changes: 0 additions & 7 deletions web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1328,13 +1328,6 @@ img.ui.avatar,
display: inline-block; /* not sure whether it is still needed */
}

.ui .button.copy-commit-sha {
border: 1px solid var(--color-light-border);
margin-right: 3px;
padding: 6px 6px 4px;
background: var(--color-light);
}

.ui .button.truncate {
display: inline-block;
max-width: 100%;
Expand Down
3 changes: 0 additions & 3 deletions web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -3051,9 +3051,6 @@ tbody.commit-list {
.commit-table th.sha {
display: none !important;
}
.commit-table .commit-list .copy-commit-sha {
display: none !important;
}
.comment-header {
flex-wrap: wrap;
}
Expand Down