Skip to content

Commit 74386d9

Browse files
authored
Merge branch 'main' into fix-15460-encrypt-ldap-bind-password-in-db
2 parents a1484ba + e542b41 commit 74386d9

File tree

14 files changed

+104
-127
lines changed

14 files changed

+104
-127
lines changed

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ See `make help` for all available `make` targets. Also see [`.drone.yml`](https:
127127

128128
## Building continuously
129129

130-
To run and continously rebuild when source files change:
130+
To run and continuously rebuild when source files change:
131131

132132
```bash
133133
make watch
@@ -216,7 +216,7 @@ You should validate your generated Swagger file and spell-check it with:
216216
make swagger-validate misspell-check
217217
```
218218

219-
You should commit the changed swagger JSON file. The continous integration
219+
You should commit the changed swagger JSON file. The continuous integration
220220
server will check that this has been done using:
221221

222222
```bash
@@ -315,7 +315,7 @@ branches as we will need to update it to main before merging and/or may be
315315
able to help fix issues directly.
316316

317317
Any PR requires two approvals from the Gitea maintainers and needs to pass the
318-
continous integration. Take a look at our
318+
continuous integration. Take a look at our
319319
[`CONTRIBUTING.md`](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md)
320320
document.
321321

options/locale/locale_pt-PT.ini

Lines changed: 39 additions & 38 deletions
Large diffs are not rendered by default.

routers/api/v1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ func Routes() *web.Route {
888888
Post(reqToken(), mustNotBeArchived, bind(api.CreatePullRequestOption{}), repo.CreatePullRequest)
889889
m.Group("/{index}", func() {
890890
m.Combo("").Get(repo.GetPullRequest).
891-
Patch(reqToken(), reqRepoWriter(models.UnitTypePullRequests), bind(api.EditPullRequestOption{}), repo.EditPullRequest)
891+
Patch(reqToken(), bind(api.EditPullRequestOption{}), repo.EditPullRequest)
892892
m.Get(".diff", repo.DownloadPullDiff)
893893
m.Get(".patch", repo.DownloadPullPatch)
894894
m.Post("/update", reqToken(), repo.UpdatePullRequest)

routers/repo/http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
174174
return
175175
}
176176

177-
if ctx.IsBasicAuth {
177+
if ctx.IsBasicAuth && ctx.Data["IsApiToken"] != true {
178178
_, err = models.GetTwoFactorByUID(ctx.User.ID)
179179
if err == nil {
180180
// TODO: This response should be changed to "invalid credentials" for security reasons once the expectation behind it (creating an app token to authenticate) is properly documented

templates/repo/diff/box.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
</div>
118118
</h4>
119119
<div class="diff-file-body ui attached unstackable table segment">
120-
<div id="diff-source-{{$i}}" class="file-body file-code has-context-menu code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}">
120+
<div id="diff-source-{{$i}}" class="file-body file-code code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}">
121121
{{if $file.IsBin}}
122122
<div class="diff-file-body binary" style="padding: 5px 10px;">{{$.i18n.Tr "repo.diff.bin_not_shown"}}</div>
123123
{{else}}
@@ -131,7 +131,7 @@
131131
{{end}}
132132
</div>
133133
{{if or $isImage $isCsv}}
134-
<div id="diff-rendered-{{$i}}" class="file-body file-code has-context-menu{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}} hide">
134+
<div id="diff-rendered-{{$i}}" class="file-body file-code {{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}} hide">
135135
<table class="chroma w-100">
136136
{{if $isImage}}
137137
{{template "repo/diff/image_diff" dict "file" . "root" $}}

templates/repo/view_file.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
</tbody>
113113
</table>
114114
{{if $.Permission.CanRead $.UnitTypeIssues}}
115-
<div class="code-view-menu-list ui fluid popup transition hidden">
115+
<div class="code-line-menu ui fluid popup transition hidden">
116116
<div class="ui column relaxed equal height">
117117
<div class="column">
118118
<div class="ui link list">

web_src/js/code/linebutton.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {svg} from '../svg.js';
2+
3+
export function showLineButton() {
4+
if ($('.code-line-menu').length === 0) return;
5+
$('.code-line-button').remove();
6+
$('.code-view td.lines-code.active').closest('tr').find('td:eq(0)').first().prepend(
7+
$(`<button class="code-line-button">${svg('octicon-kebab-horizontal')}</button>`)
8+
);
9+
$('.code-line-menu').appendTo($('.code-view'));
10+
$('.code-line-button').popup({popup: $('.code-line-menu'), on: 'click'});
11+
}

web_src/js/index.js

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {initMarkupAnchors} from './markup/anchors.js';
2222
import {initNotificationsTable, initNotificationCount} from './features/notification.js';
2323
import {initStopwatch} from './features/stopwatch.js';
2424
import {renderMarkupContent} from './markup/content.js';
25+
import {showLineButton} from './code/linebutton.js';
2526
import {stripTags, mqBinarySearch} from './utils.js';
2627
import {svg, svgs} from './svg.js';
2728

@@ -2213,49 +2214,6 @@ function searchRepositories() {
22132214
});
22142215
}
22152216

2216-
function showCodeViewMenu() {
2217-
if ($('.code-view-menu-list').length === 0) {
2218-
return;
2219-
}
2220-
2221-
// Get clicked tr
2222-
const $code_tr = $('.code-view td.lines-code.active').parent();
2223-
2224-
// Reset code line marker
2225-
$('.code-view-menu-list').appendTo($('.code-view'));
2226-
$('.code-line-marker').remove();
2227-
2228-
// Generate new one
2229-
const icon_wrap = $('<div>', {
2230-
class: 'code-line-marker'
2231-
}).prependTo($code_tr.find('td:eq(0)').get(0)).hide();
2232-
2233-
const a_wrap = $('<a>', {
2234-
class: 'code-line-link'
2235-
}).appendTo(icon_wrap);
2236-
2237-
$('<i>', {
2238-
class: 'dropdown icon',
2239-
style: 'margin: 0px;'
2240-
}).appendTo(a_wrap);
2241-
2242-
icon_wrap.css({
2243-
left: '-7px',
2244-
display: 'block',
2245-
});
2246-
2247-
$('.code-view-menu-list').css({
2248-
'min-width': '220px',
2249-
});
2250-
2251-
// Popup the menu
2252-
$('.code-line-link').popup({
2253-
popup: $('.code-view-menu-list'),
2254-
on: 'click',
2255-
lastResort: 'bottom left',
2256-
});
2257-
}
2258-
22592217
function initCodeView() {
22602218
if ($('.code-view .lines-num').length > 0) {
22612219
$(document).on('click', '.lines-num span', function (e) {
@@ -2268,9 +2226,7 @@ function initCodeView() {
22682226
}
22692227
selectRange($list, $list.filter(`[rel=${$select.attr('id')}]`), (e.shiftKey ? $list.filter('.active').eq(0) : null));
22702228
deSelect();
2271-
2272-
// show code view menu marker
2273-
showCodeViewMenu();
2229+
showLineButton();
22742230
});
22752231

22762232
$(window).on('hashchange', () => {
@@ -2285,21 +2241,15 @@ function initCodeView() {
22852241
if (m) {
22862242
$first = $list.filter(`[rel=${m[1]}]`);
22872243
selectRange($list, $first, $list.filter(`[rel=${m[2]}]`));
2288-
2289-
// show code view menu marker
2290-
showCodeViewMenu();
2291-
2244+
showLineButton();
22922245
$('html, body').scrollTop($first.offset().top - 200);
22932246
return;
22942247
}
22952248
m = window.location.hash.match(/^#(L|n)(\d+)$/);
22962249
if (m) {
22972250
$first = $list.filter(`[rel=L${m[2]}]`);
22982251
selectRange($list, $first);
2299-
2300-
// show code view menu marker
2301-
showCodeViewMenu();
2302-
2252+
showLineButton();
23032253
$('html, body').scrollTop($first.offset().top - 200);
23042254
}
23052255
}).trigger('hashchange');

web_src/js/svg.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import octiconGitMerge from '../../public/img/svg/octicon-git-merge.svg';
44
import octiconGitPullRequest from '../../public/img/svg/octicon-git-pull-request.svg';
55
import octiconIssueClosed from '../../public/img/svg/octicon-issue-closed.svg';
66
import octiconIssueOpened from '../../public/img/svg/octicon-issue-opened.svg';
7+
import octiconKebabHorizontal from '../../public/img/svg/octicon-kebab-horizontal.svg';
78
import octiconLink from '../../public/img/svg/octicon-link.svg';
89
import octiconLock from '../../public/img/svg/octicon-lock.svg';
910
import octiconMilestone from '../../public/img/svg/octicon-milestone.svg';
@@ -20,6 +21,7 @@ export const svgs = {
2021
'octicon-git-pull-request': octiconGitPullRequest,
2122
'octicon-issue-closed': octiconIssueClosed,
2223
'octicon-issue-opened': octiconIssueOpened,
24+
'octicon-kebab-horizontal': octiconKebabHorizontal,
2325
'octicon-link': octiconLink,
2426
'octicon-lock': octiconLock,
2527
'octicon-milestone': octiconMilestone,

web_src/less/_base.less

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,19 @@ a.ui.card:hover,
560560
border-color: var(--color-secondary);
561561
}
562562

563+
.ui.link.list .item,
564+
.ui.link.list a.item,
565+
.ui.link.list .item a:not(.ui) {
566+
color: var(--color-text);
567+
}
568+
569+
.ui.link.list.list a.item:hover,
570+
.ui.link.list.list .item a:not(.ui):hover,
571+
.ui.link.list.list a.item:active,
572+
.ui.link.list.list .item a:not(.ui):active {
573+
color: var(--color-text-dark);
574+
}
575+
563576
.dont-break-out {
564577
overflow-wrap: break-word;
565578
word-wrap: break-word;
@@ -1565,20 +1578,8 @@ a.ui.label:hover {
15651578
border-bottom: 1px solid var(--color-secondary);
15661579
}
15671580
}
1568-
.code-view {
1569-
overflow: auto;
1570-
overflow-x: auto;
1571-
overflow-y: hidden;
1572-
1573-
&.has-context-menu {
1574-
overflow: visible;
1575-
overflow-x: visible;
1576-
overflow-y: visible;
1577-
}
1578-
1579-
table {
1580-
width: 100%;
1581-
}
1581+
.code-view table {
1582+
width: 100%;
15821583
}
15831584

15841585
.octicon-tiny {

web_src/less/_repository.less

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,10 +3139,3 @@ td.blob-excerpt {
31393139
transform: scale(105%);
31403140
box-shadow: 0 .5rem 1rem var(--color-shadow) !important;
31413141
}
3142-
3143-
.code-line-marker {
3144-
width: 13px;
3145-
height: 20px;
3146-
background-color: rgb(34 36 38 / 15%);
3147-
position: absolute;
3148-
}

web_src/less/code/linebutton.less

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.code-view .lines-num:hover {
2+
color: var(--color-text-dark) !important;
3+
}
4+
5+
.code-line-menu {
6+
width: auto !important;
7+
}
8+
9+
.code-line-button {
10+
background-color: var(--color-menu);
11+
color: var(--color-text-light);
12+
border: 1px solid var(--color-secondary);
13+
border-radius: var(--border-radius);
14+
padding: 1px 10px;
15+
position: absolute;
16+
font-family: var(--fonts-regular);
17+
left: 0;
18+
transform: translateX(-70%);
19+
cursor: pointer;
20+
21+
&:hover {
22+
color: var(--color-primary);
23+
}
24+
}

web_src/less/index.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
@import "./features/projects.less";
1212
@import "./markup/content.less";
1313
@import "./markup/mermaid.less";
14+
@import "./code/linebutton.less";
1415

1516
@import "./chroma/base.less";
1617
@import "./chroma/light.less";

web_src/less/themes/theme-arc-green.less

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@
153153
background: #353945;
154154
}
155155

156-
.ui.link.list .item,
157-
.ui.link.list a.item,
158-
.ui.link.list .item a:not(.ui) {
159-
color: #dbdbdb;
160-
}
161-
162156
.ui.red.label,
163157
.ui.red.labels .label {
164158
background-color: #7d3434 !important;

0 commit comments

Comments
 (0)