]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoAdd HAProxy Config to reverse-proxies.en-us.md (#17407)
Kane [Sun, 24 Oct 2021 15:48:26 +0000 (17:48 +0200)]
Add HAProxy Config to reverse-proxies.en-us.md (#17407)

* Update reverse-proxies.en-us.md

Addition of HAProxy

* Update reverse-proxies.en-us.md

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 24 Oct 2021 00:25:14 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix issue content history problems, improve UI (#17404)
wxiaoguang [Sat, 23 Oct 2021 14:48:16 +0000 (22:48 +0800)]
Fix issue content history problems, improve UI (#17404)

* Improve: make diff result better, make the HTML element fit the full height in the content history diff dialog
* Bug fix: when edit the main issue, the poster is wrongly set to the issue poster

2 years agoFix issue content history problems, improve UI (#17404)
wxiaoguang [Sat, 23 Oct 2021 14:47:38 +0000 (22:47 +0800)]
Fix issue content history problems, improve UI (#17404)

* Improve: make diff result better, make the HTML element fit the full height in the content history diff dialog
* Bug fix: when edit the main issue, the poster is wrongly set to the issue poster

2 years agoFix issue markdown bugs (#17411)
wxiaoguang [Sat, 23 Oct 2021 13:38:12 +0000 (21:38 +0800)]
Fix issue markdown bugs (#17411)

* Bug fix: render Markdown http://AppURL/org/repo/issues/4?a=1&b=2#comment-123 test to HTML correctly, close #17394
* Bug fix: fix the positions of checkboxes in rendered HTML, close #17395

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 23 Oct 2021 00:28:47 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRemove deprecated `extendDefaultPlugins` method of svgo (#17399)
Mashiro [Fri, 22 Oct 2021 20:05:53 +0000 (04:05 +0800)]
Remove deprecated `extendDefaultPlugins` method of svgo (#17399)

2 years agoFrontport Changelog 1.15.5 (#17392) (#17401)
zeripath [Fri, 22 Oct 2021 16:32:08 +0000 (17:32 +0100)]
Frontport Changelog 1.15.5 (#17392) (#17401)

2 years agoFix context popup error (#17398)
wxiaoguang [Fri, 22 Oct 2021 14:34:01 +0000 (22:34 +0800)]
Fix context popup error (#17398)

* Fix context popup error

2 years agoAdd groups scope/claim to OIDC/OAuth2 Provider (#17367)
Nico Schieder [Fri, 22 Oct 2021 09:19:24 +0000 (11:19 +0200)]
Add groups scope/claim to OIDC/OAuth2 Provider (#17367)

* Add groups scope/claim to OICD/OAuth2

Add support for groups claim as part of the OIDC/OAuth2 flow.
Groups is a list of "org" and "org:team" strings to allow clients to
authorize based on the groups a user is part of.

Signed-off-by: Nico Schieder <code@nico-schieder.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoStop sanitizing full name in API (#17396)
zeripath [Fri, 22 Oct 2021 07:17:35 +0000 (08:17 +0100)]
Stop sanitizing full name in API (#17396)

The API convert.toUser function makes the incorrect assumption that full names could
be rendered as is without being escaped. It therefore runs the names through
markup.Sanitize which leads to a double escape of user full names. This
pr stops this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 22 Oct 2021 00:25:10 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRe-separate the color translation strings (#17390)
zeripath [Thu, 21 Oct 2021 21:51:03 +0000 (22:51 +0100)]
Re-separate the color translation strings (#17390)

Fix #17384

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix the click behavior for <tr> and <td> with [data-href] (#17388)
wxiaoguang [Thu, 21 Oct 2021 18:19:32 +0000 (02:19 +0800)]
Fix the click behavior for <tr> and <td> with [data-href] (#17388)

2 years agoRefactor update checker to use AppState (#17387)
wxiaoguang [Thu, 21 Oct 2021 16:10:49 +0000 (00:10 +0800)]
Refactor update checker to use AppState (#17387)

We have the `AppState` module now, it can store app related data easily. We do not need to create separate tables for each feature.

So the update checker can use `AppState` instead of a one-row dedicate table.

And the code of update checker is moved from `models` to `modules`.

2 years agoFix SVG side by side comparison link (#17375)
Mario Lubenka [Thu, 21 Oct 2021 10:43:26 +0000 (12:43 +0200)]
Fix SVG side by side comparison link (#17375)

* Remove swipe-bar z-index

Fixes position of swipe-bar so it does not overlay other UI components when scrolling.

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Unique names for image tabs in pull request

Define unique names for image tabs in pull requests, in order to toggle tabs correctly when multiple are displayed on one page.

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix history count failure (#17351)
Lunny Xiao [Thu, 21 Oct 2021 10:06:19 +0000 (18:06 +0800)]
Fix history count failure (#17351)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoSync gitea app path for git hooks and authorized keys when starting (#17335)
wxiaoguang [Thu, 21 Oct 2021 09:22:43 +0000 (17:22 +0800)]
Sync gitea app path for git hooks and authorized keys when starting (#17335)

Gitea writes its own AppPath into git hook scripts. If Gitea's AppPath changes, then the git push will fail.

This PR:

* Introduce an AppState module, it can persist app states into database
* During GlobalInit, Gitea will check if the current AppPath is the same as last one. If they don't match, Gitea will sync git hooks.
* Refactor some code to make them more clear.
* Also, "Detect if gitea binary's name changed" #11341 is related, we call models.RewriteAllPublicKeys to update ssh authorized_keys file

2 years agoHandle broken references in mirror sync (#17013)
zeripath [Thu, 21 Oct 2021 08:45:25 +0000 (09:45 +0100)]
Handle broken references in mirror sync (#17013)

* Handle broken references in mirror sync

If there are broken references during a mirror attempt to fix using `git remote prune`.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFrontend refactor, PascalCase to camelCase, remove unused code (#17365)
wxiaoguang [Thu, 21 Oct 2021 07:37:43 +0000 (15:37 +0800)]
Frontend refactor, PascalCase to camelCase, remove unused code (#17365)

* Frontend refactor, PascalCase to camelCase, remove unused code

* fix

2 years agoFix heatmap test (#17381)
Lunny Xiao [Thu, 21 Oct 2021 06:37:40 +0000 (14:37 +0800)]
Fix heatmap test (#17381)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 21 Oct 2021 00:25:11 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoEnsure correct SSH permissions check for private and restricted users (#17370)
zeripath [Wed, 20 Oct 2021 20:59:05 +0000 (21:59 +0100)]
Ensure correct SSH permissions check for private and restricted users (#17370)

Repositories owned by private users and organisations and pulls by restricted users
need to have permissions checked. Previously Serv would simply assumed that if the
user could log in and the repository was not private then it would be visible.

Fix #17364

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoUpgrade Bluemonday to v1.0.16 (#17372)
zeripath [Wed, 20 Oct 2021 20:58:39 +0000 (21:58 +0100)]
Upgrade Bluemonday to v1.0.16 (#17372)

Upgrade Bluemonday to latest version

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoOffer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH (#17281)
zeripath [Wed, 20 Oct 2021 19:55:33 +0000 (20:55 +0100)]
Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH (#17281)

* Offer rsa-sha2-512 and rsa-sha2-256 algorithms in internal SSH

There is a subtle bug in the SSH library x/crypto/ssh which makes the incorrect
assumption that the public key type is the same as the signature algorithm type.

This means that only ssh-rsa signatures are offered by default.

This PR adds a workaround around this problem.

Fix #17175

Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per review

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoPrevent NPE in CSV diff rendering when column removed (#17018)
Richard Mahn [Wed, 20 Oct 2021 19:10:03 +0000 (13:10 -0600)]
Prevent NPE in CSV diff rendering when column removed (#17018)

Fixes #16837 if a column is deleted.

We were clobbering the columns that were added by looping through the aline (base) and then when bline (head) was looped through, it clobbered what was in the "cells" array that is show in the diff, and then left a nil cell because nothing was shifted.

This fix properly shifts the cells, and properly puts the b cell either at its location or after, according to what the aline placed in the cells.

This includes test, adding a new test function since adding/removing cells works best with three columns, not two, which results in 4 columns of the resulting cells because it has a deleted column and an added column. If you try this locally, you can try those cases and others, such as adding a column.

There was no need to do anything special for the rows when `aline == 0 || bline == 0` so that was removed. This allows the same code to be used for removed or added lines, with the bcell text always being the RightCell, acell text being the LeftCell.

I still added the patch zeripath gave at https://github.com/go-gitea/gitea/issues/16837#issuecomment-913007382 so that just in case for some reason a cell is nil (which shouldn't happen now) it doesn't throw a 500 error, so the user can at least view the raw diff.

Also fixes in the [view.go](https://github.com/go-gitea/gitea/pull/17018/files#diff-43a7f4747c7ba8bff888c9be11affaafd595fd55d27f3333840eb19df9fad393L521) file how if a CSV file is empty (either created empty or if you edit it and remove all contents) it throws a huge 500 error when you then save it (when you view the file). Since we allow creating, saving and pushing empty files, we shouldn't throw an error on an empty CSV file, but just show its empty contents. This doesn't happen if it is a Markdown file or other type of file that is empty.
EDIT: Now handled in the markup/csv renderer code

2 years agoUse a variable but a function for IsProd because of a slight performance increment...
Lunny Xiao [Wed, 20 Oct 2021 14:37:19 +0000 (22:37 +0800)]
Use a variable but a function for IsProd because of a slight performance increment (#17368)

2 years ago "Copy branch name" button in pull request (#17323)
Mario Lubenka [Tue, 19 Oct 2021 17:32:11 +0000 (19:32 +0200)]
 "Copy branch name" button in pull request (#17323)

* Drop data-original from clipboard

data-original attribute was removed. Instead, the original value from
data-content is set after success/fail message was displayed.

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* "Copy branch name" button in pull request

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
* Update templates/repo/issue/view_title.tmpl

Co-authored-by: silverwind <me@silverwind.io>
* Apply suggestions from code review

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoRename .air.conf to .air.toml (#17360)
silverwind [Tue, 19 Oct 2021 16:27:29 +0000 (18:27 +0200)]
Rename .air.conf to .air.toml (#17360)

As of https://github.com/cosmtrek/air/pull/90, the preferred file
extension is .toml. The file format was always toml itself.

2 years agoRe-allow clipboard copy on non-https sites (#17118)
Netduma Luke M [Tue, 19 Oct 2021 10:22:16 +0000 (11:22 +0100)]
Re-allow clipboard copy on non-https sites (#17118)

* Re-allow clipboard copy on non-https sites
* fallback clipboard functions

2 years agoUpdate JS dependencies (#17357)
silverwind [Tue, 19 Oct 2021 07:23:58 +0000 (09:23 +0200)]
Update JS dependencies (#17357)

* Update JS dependencies

- Upgrade to eslint 8 and add new plugin rules
- Adapt to various API changes
- Rebuild SVGs

* fix webpack warning on license

* order options alphabetically

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix dashboard repolist alignment and repolisting (#17355)
zeripath [Tue, 19 Oct 2021 04:38:33 +0000 (05:38 +0100)]
Fix dashboard repolist alignment and repolisting (#17355)

Unfortunately #17301 broke the restriction of the dashboard repolist to
the user's repos because it stopped passing in the uid for the current
user. This PR restores this.

There is also a weird alignment problem - not caused by that PR - where
the menu items in the repolist spread over multiple lines. This PR
simply reduces the padding on these items and switches the justification
of the flex elements to space-evenly.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 19 Oct 2021 00:25:06 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoDisable form autofill (#17291)
wxiaoguang [Mon, 18 Oct 2021 22:08:41 +0000 (06:08 +0800)]
Disable form autofill (#17291)

]* fix aria-hidden and tabindex

* use {{template "base/disable_form_autofill"}} instead of {{DisableFormAutofill}}

Co-authored-by: zeripath <art27@cantab.net>
2 years agoAllow mocking timeutil (#17354)
John Olheiser [Mon, 18 Oct 2021 20:12:26 +0000 (15:12 -0500)]
Allow mocking timeutil (#17354)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
3 years agodocs: add permission notes to `SSH Container Passthrough` (#17347)
Mashiro [Mon, 18 Oct 2021 16:26:47 +0000 (00:26 +0800)]
docs: add permission notes to `SSH Container Passthrough` (#17347)

* Update with-docker.en-us.md

* Update with-docker.en-us.md

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years agoapi: integration test for nodeinfo (#17346)
techknowlogick [Mon, 18 Oct 2021 05:36:56 +0000 (01:36 -0400)]
api: integration test for nodeinfo (#17346)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 18 Oct 2021 00:25:12 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoUse go1.16+ way of installing binaries (#17342)
techknowlogick [Sun, 17 Oct 2021 22:57:15 +0000 (18:57 -0400)]
Use go1.16+ way of installing binaries (#17342)

3 years agoFix some lints (#17337)
Lunny Xiao [Sun, 17 Oct 2021 19:47:12 +0000 (03:47 +0800)]
Fix some lints (#17337)

Fix some linting problems.

3 years agoMove session to models/login (#17338)
Lunny Xiao [Sun, 17 Oct 2021 18:51:56 +0000 (02:51 +0800)]
Move session to models/login (#17338)

Move model/session.go to models/login

3 years agoHide command line merge instructions when user can't push (#17339)
qwerty287 [Sun, 17 Oct 2021 16:58:36 +0000 (18:58 +0200)]
Hide command line merge instructions when user can't push (#17339)

Hides the command line instructions if the authenticated user can't push to the base branch.
Closes #17121

3 years agofix: repository summary on mobile (#17322)
kolaente [Sun, 17 Oct 2021 14:05:32 +0000 (16:05 +0200)]
fix: repository summary on mobile (#17322)

This PR fixes the repository summary on mobile. Most of it is vertically centering things and some spacing.

#### Before:
![Screen Shot 2021-10-15 at 19 12 25](https://user-images.githubusercontent.com/13721712/137528901-021867b5-73c3-4f48-8408-18bc573f5ee7.png)

#### After:
![Screen Shot 2021-10-15 at 19 28 06](https://user-images.githubusercontent.com/13721712/137528970-058a66fd-d5d9-44ea-ba5f-998bf8cbf4fe.png)

3 years agoMake the Mirror Queue a queue (#17326)
zeripath [Sun, 17 Oct 2021 11:43:25 +0000 (12:43 +0100)]
Make the Mirror Queue a queue (#17326)

Convert the old mirror syncing queue to the more modern queue format.

Fix a bug in the from the repo-archive queue PR - the assumption was made that uniqueness could be enforced with by checking equality in a map in channel unique queues - however this only works for primitive types - which was the initial intention but is an imperfect. This is fixed by marshalling the data and placing the martialled data in the unique map instead.

The documentation is also updated to add information about the deprecated configuration values.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoEnsure popup text is aligned left (#17327)
Mario Lubenka [Sun, 17 Oct 2021 10:14:32 +0000 (12:14 +0200)]
Ensure popup text is aligned left (#17327)

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 17 Oct 2021 00:29:40 +0000 (00:29 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoFix the PR review form bug during frontend refactor (#17332)
wxiaoguang [Sat, 16 Oct 2021 20:30:31 +0000 (04:30 +0800)]
Fix the PR review form bug during frontend refactor (#17332)

3 years agoSplit `index.js` to separate files (#17315)
wxiaoguang [Sat, 16 Oct 2021 17:28:04 +0000 (01:28 +0800)]
Split `index.js` to separate files (#17315)

* split `index.js` to separate files

* tune clipboard

* fix promise

* fix document

* remove intermediate empty file

* fix async event listener

* use `export function` instead of `export {}`, add more comments

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAdd RSS/Atom feed support for user actions (#16002)
6543 [Sat, 16 Oct 2021 14:21:16 +0000 (16:21 +0200)]
Add RSS/Atom feed support for user actions (#16002)

Return rss/atom feed for user based on rss url suffix or Content-Type header.

3 years agoAdd simple update checker to Gitea (#17212)
techknowlogick [Sat, 16 Oct 2021 06:14:34 +0000 (02:14 -0400)]
Add simple update checker to Gitea (#17212)

* Add simple update checker to Gitea

* update struct and remove comments

* fix lint

* Update custom/conf/app.example.ini

* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: delvh <dev.lh@web.de>
* Update custom/conf/app.example.ini

Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: Steven <61625851+justusbunsi@users.noreply.github.com>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

* Update modules/cron/tasks_extended.go

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update custom/conf/app.example.ini

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* take PR feedback into account and display banner on admin dashboard for alerts

* Add more detailed message

* placate lint

* update per feedback

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Steven <61625851+justusbunsi@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years agoUpdate documents for Gitea behind reverse proxy. Fix some small bugs (some URLs are...
wxiaoguang [Sat, 16 Oct 2021 03:34:07 +0000 (11:34 +0800)]
Update documents for Gitea behind reverse proxy. Fix some small bugs (some URLs are generated without sub-path) (#17320)

* Apache `ProxyPassReverse` only works for Location, Content-Location and URI headers on HTTP redirect responses, it causes more problems than it resolves. Now all URLs generated by Gitee have the correct prefix AppSubURL. We do not need to set `ProxyPassReverse`.

* fix url param

* use AppSubURL instead of AppURL in api/v1

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agofix: issue close/comment buttons on mobile (#17317)
kolaente [Sat, 16 Oct 2021 02:55:06 +0000 (04:55 +0200)]
fix: issue close/comment buttons on mobile (#17317)

* fix: issue close/comment buttons on mobile

* fix: lint

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years agofix: code review comments on mobile (#17321)
kolaente [Sat, 16 Oct 2021 02:22:24 +0000 (04:22 +0200)]
fix: code review comments on mobile (#17321)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 16 Oct 2021 00:25:26 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoCheck for context exceeded in WalkGitLog (#17319)
zeripath [Fri, 15 Oct 2021 18:41:34 +0000 (19:41 +0100)]
Check for context exceeded in WalkGitLog (#17319)

There is a slight race in checking of a context deadline exceed in #16467
which leads to a 500 on the repository page.

The solution is to check the error coming back from `*LogNameStatusRepoParser.Next()`
and if it is the `ContextDeadlineExceeded` break from the loop.

Fix #17314

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd buttons to allow loading of incomplete diffs (#16829)
zeripath [Fri, 15 Oct 2021 16:05:33 +0000 (17:05 +0100)]
Add buttons to allow loading of incomplete diffs (#16829)

This PR adds two buttons to the stats and the end of the diffs list to load the (some of) the remaining incomplete diff sections.

Contains #16775

Signed-off-by: Andrew Thornton <art27@cantab.net>
## Screenshots

### Show more button at the end of the diff
![Screenshot from 2021-09-04 11-12-37](https://user-images.githubusercontent.com/1824502/132091009-b1f6113e-2c04-4be5-8a04-b8ecea56887b.png)

### Show more button at the end of the diff stats box
![Screenshot from 2021-09-04 11-14-54](https://user-images.githubusercontent.com/1824502/132091063-86da5a6d-6628-4b82-bea9-3655cd9f40f6.png)

3 years agoMultiple tokens support for migrating from github (#17134)
Lunny Xiao [Fri, 15 Oct 2021 05:47:15 +0000 (13:47 +0800)]
Multiple tokens support for migrating from github (#17134)

* multiple tokens support for migrating from github

* improve code and token description

* Fix bug

* Add comment for get client

3 years agoFrontend refactor: move Vue related code from `index.js` to `components` dir, and...
wxiaoguang [Fri, 15 Oct 2021 02:35:26 +0000 (10:35 +0800)]
Frontend refactor: move Vue related code from `index.js` to `components` dir, and remove unused codes. (#17301)

* frontend refactor

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
* Update templates/base/head.tmpl

Co-authored-by: delvh <dev.lh@web.de>
* Update docs/content/doc/developers/guidelines-frontend.md

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* fix typo

* fix typo

* refactor PageData to pageData

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
* Simply for the visual difference.

Co-authored-by: delvh <dev.lh@web.de>
* Revert "Apply suggestions from code review"

This reverts commit 4d78ad9b0e96ca180e0823de17659a2e0814c099.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 15 Oct 2021 00:25:10 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoShow direct match on top for user search (#17303)
Maximilian Weiler [Thu, 14 Oct 2021 23:48:47 +0000 (01:48 +0200)]
Show direct match on top for user search (#17303)

This PR makes sure that direct matches in the user search always show on top of the result list.

The following places were checked to follow the desired behavior now:
- Search when adding a user to a team
- Search when adding a user as a collaborator to a repository

Signed-off-by: Maximilian Weiler <16721506+maweil@users.noreply.github.com>
3 years agoDon't panic if we fail to parse U2FRegistration data (#17304)
David Jimenez [Thu, 14 Oct 2021 16:37:35 +0000 (17:37 +0100)]
Don't panic if we fail to parse U2FRegistration data (#17304)

* Don't panic if we fail to parse a U2FRegistration data

Downgrade logging statement from Fatal to Error so that errors parsing
U2FRegistration data does not panic; instead, the invalid key will be
skipped and we will attempt to parse the next one, if available.

Signed-off-by: David Jimenez <dvejmz@sgfault.com>
3 years agoUpgrade chi to v5 (#17298)
Lunny Xiao [Thu, 14 Oct 2021 02:50:23 +0000 (10:50 +0800)]
Upgrade chi to v5 (#17298)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 14 Oct 2021 00:25:07 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoEnsure that git daemon export ok is created for mirrors (#17243)
zeripath [Wed, 13 Oct 2021 19:47:02 +0000 (20:47 +0100)]
Ensure that git daemon export ok is created for mirrors (#17243)

* Ensure that git daemon export ok is created for mirrors

There is an issue with #16508 where it appears that create repo requires that the
repo does not exist. This causes #17241 where an error is reported because of this.

This PR fixes this and also runs update-server-info for mirrors and generated repos.

Fix #17241

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoDisable core.protectNTFS (#17300)
zeripath [Wed, 13 Oct 2021 18:20:11 +0000 (19:20 +0100)]
Disable core.protectNTFS (#17300)

core.protectNTFS protects NTFS from files which may be difficult to remove or interact
with using the win32 api, however, it also appears to prevent such files from
being entered into the git indexes - fundamentally causing breakages with PRs that
affect these files. However, deliberately setting this to false may cause security
issues due to the remain sparse checkout of files in the merge pipeline.

The only sensible option therefore is to provide an optional setting which admins
could set which would forcibly switch this off if they are affected by this issue.

Fix #17092

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoUse pointer for wrappedConn methods (#17295)
zeripath [Tue, 12 Oct 2021 20:55:18 +0000 (21:55 +0100)]
Use pointer for wrappedConn methods (#17295)

Fix #17294

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoAdd user status filter to admin user management page (#16770)
wxiaoguang [Tue, 12 Oct 2021 18:11:35 +0000 (02:11 +0800)]
Add user status filter to admin user management page (#16770)

It makes Admin's life easier to filter users by various status.

* introduce window.config.PageData to pass template data to javascript module and small refactor

move legacy window.ActivityTopAuthors to window.config.PageData.ActivityTopAuthors
make HTML structure more IDE-friendly in footer.tmpl and head.tmpl
remove incorrect <style class="list-search-style"></style> in head.tmpl
use log.Error instead of log.Critical in admin user search

* use LEFT JOIN instead of SubQuery when admin filters users by 2fa. revert non-en locale.

* use OptionalBool instead of status map

* refactor SearchUserOptions.toConds to SearchUserOptions.toSearchQueryBase

* add unit test for user search

* only allow admin to use filters to search users

3 years ago[API] Add endpount to get user org permissions (#17232)
Romain [Tue, 12 Oct 2021 10:47:19 +0000 (12:47 +0200)]
[API] Add endpount to get user org permissions (#17232)

* Add endpoint

* Add swagger response + generate swagger

* Stop execution if user / org is not found

* Add tests

Co-authored-by: 6543 <6543@obermui.de>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 12 Oct 2021 00:25:09 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAutoRegistration is supposed to be working with disabled registration (#17219)
Viktor Kuzmin [Mon, 11 Oct 2021 16:23:59 +0000 (20:23 +0400)]
AutoRegistration is supposed to be working with disabled registration (#17219)

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years agoOpen markdown image links in new window (#17287)
wxiaoguang [Mon, 11 Oct 2021 12:12:06 +0000 (20:12 +0800)]
Open markdown image links in new window (#17287)

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 11 Oct 2021 00:25:06 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoSave and view issue/comment content history (#16909)
wxiaoguang [Sun, 10 Oct 2021 22:40:03 +0000 (06:40 +0800)]
Save and view issue/comment content history (#16909)

* issue content history

* Use timeutil.TimeStampNow() for content history time instead of issue/comment.UpdatedUnix (which are not updated in time)

* i18n for frontend

* refactor

* clean up

* fix refactor

* re-format

* temp refactor

* follow db refactor

* rename IssueContentHistory to ContentHistory, remove empty model tags

* fix html

* use avatar refactor to generate avatar url

* add unit test, keep at most 20 history revisions.

* re-format

* syntax nit

* Add issue content history table

* Update models/migrations/v197.go

Co-authored-by: 6543 <6543@obermui.de>
* fix merge

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 10 Oct 2021 00:25:11 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 9 Oct 2021 00:25:09 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agochangelog for 1.15.4 (frontport) (#17273)
techknowlogick [Fri, 8 Oct 2021 21:51:57 +0000 (17:51 -0400)]
changelog for 1.15.4 (frontport) (#17273)

3 years agoAdd a simple way to rename branch like gh (#15870)
a1012112796 [Fri, 8 Oct 2021 17:03:04 +0000 (01:03 +0800)]
Add a simple way to rename branch like gh (#15870)

- Update default branch if needed
- Update protected branch if needed
- Update all not merged pull request base branch name
- Rename git branch
- Record this rename work and auto redirect for old branch on ui

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: delvh <dev.lh@web.de>
3 years agoMove add deploy key form before the list and add a cancel button (#17228)
qwerty287 [Fri, 8 Oct 2021 16:15:09 +0000 (18:15 +0200)]
Move add deploy key form before the list and add a cancel button (#17228)

3 years agoDefer Last Commit Info (#16467)
zeripath [Fri, 8 Oct 2021 13:08:22 +0000 (14:08 +0100)]
Defer Last Commit Info (#16467)

One of the biggest reasons for slow repository browsing is that we wait
until last commit information has been generated for all files in the
repository.

This PR proposes deferring this generation to a new POST endpoint that
does the look up outside of the main page request.

Signed-off-by: Andrew Thornton <art27@cantab.net>
3 years agoRemove heads pointing to missing old refs (#17076)
99rgosse [Fri, 8 Oct 2021 09:59:35 +0000 (11:59 +0200)]
Remove heads pointing to missing old refs (#17076)

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix incorrect repository count on organization tab of dashboard (#17256)
Jimmy Praet [Fri, 8 Oct 2021 06:49:20 +0000 (08:49 +0200)]
Fix incorrect repository count on organization tab of dashboard (#17256)

Fixes #17249

3 years agoAllow adding multiple issues to a project (#17226)
qwerty287 [Thu, 7 Oct 2021 22:00:02 +0000 (00:00 +0200)]
Allow adding multiple issues to a project  (#17226)

Adds an option like for adding multiple issues to a milestone.
Closes #17216

3 years agoFix unwanted team review request deletion (#17257)
Jimmy Praet [Thu, 7 Oct 2021 20:39:59 +0000 (22:39 +0200)]
Fix unwanted team review request deletion (#17257)

Add missing issue_id = ? to where clause
Fixes #17251

3 years agoHandle duplicate keys on GPG key ring (#17242)
zeripath [Thu, 7 Oct 2021 20:10:14 +0000 (21:10 +0100)]
Handle duplicate keys on GPG key ring (#17242)

It is possible that a keyring can contain duplicate keys on a keyring due to jpegs or
other layers. This currently leads to a confusing error for the user - where we report
a duplicate key insertion.

This PR simply coalesces keys into one key if there are duplicates.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix broken Activities link in team dashboard (#17255)
Jimmy Praet [Thu, 7 Oct 2021 18:27:38 +0000 (20:27 +0200)]
Fix broken Activities link in team dashboard (#17255)

Remove '/' suffix from organization dashboard link

Fixes #17250

3 years agoAdd protection to disable Gitea when run as root (#17168)
techknowlogick [Thu, 7 Oct 2021 08:52:08 +0000 (04:52 -0400)]
Add protection to disable Gitea when run as root (#17168)

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoAPI pull's head/base have correct permission (#17214)
pricly-yellow [Thu, 7 Oct 2021 00:03:37 +0000 (07:03 +0700)]
API pull's head/base have correct permission (#17214)

close #17181

* for all pull requests API return permissions of caller
* for all webhook return empty permissions

Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
3 years agoFix problem when database ID is not incremented as expected (#17229)
finga [Wed, 6 Oct 2021 20:36:24 +0000 (22:36 +0200)]
Fix problem when database ID is not incremented as expected (#17229)

Although #17124 fixed the same issue for the feed, some other parts
with the same issue were found.

Co-authored-by: finga <finga@onders.org>
3 years agofix navbar ui (#17235)
wxiaoguang [Wed, 6 Oct 2021 15:22:44 +0000 (23:22 +0800)]
fix navbar ui (#17235)

3 years agoCI: migrate from 'plugins/s3:1' to 'woodpeckerci/plugin-s3:latest' (#17234)
6543 [Wed, 6 Oct 2021 11:58:11 +0000 (13:58 +0200)]
CI: migrate from 'plugins/s3:1' to 'woodpeckerci/plugin-s3:latest' (#17234)

- this fixes the CI release upload issues, as the docker image for this is freshly built (unlike the mostly unmaintained "official" drone plugins), thus containing current CA certs needed for letsencrypt since 2021-09-31.
- woodpecker is a drone-ci fork maintained partially by @6543. it's API compatible with current drone plugins afaik

3 years agoAvatar refactor, move avatar code from `models` to `models.avatars`, remove duplicate...
wxiaoguang [Tue, 5 Oct 2021 23:25:46 +0000 (07:25 +0800)]
Avatar refactor, move avatar code from `models` to `models.avatars`, remove duplicated code (#17123)

Why this refactor

The goal is to move most files from `models` package to `models.xxx` package. Many models depend on avatar model, so just move this first.

And the existing logic is not clear, there are too many function like `AvatarLink`, `RelAvatarLink`, `SizedRelAvatarLink`, `SizedAvatarLink`, `MakeFinalAvatarURL`, `HashedAvatarLink`, etc. This refactor make everything clear:

* user.AvatarLink()
* user.AvatarLinkWithSize(size)
* avatars.GenerateEmailAvatarFastLink(email, size)
* avatars.GenerateEmailAvatarFinalLink(email, size)

And many duplicated code are deleted in route handler, the handler and the model share the same avatar logic now.

3 years agoRemove Dashboard/Home button from the navbar (#16844)
n [Tue, 5 Oct 2021 20:42:02 +0000 (05:42 +0900)]
Remove Dashboard/Home button from the navbar (#16844)

This removes the Dashboard/Home buttons and adds its text to the title of the logo.

Co-authored-by: Alexey 〒erentyev <axifnx@gmail.com>
3 years agoRedirect on project after issue created (#17211)
Romain [Tue, 5 Oct 2021 19:21:52 +0000 (21:21 +0200)]
Redirect on project after issue created (#17211)

close #17011

If user create an issue with button in project view, after issue is created the user is redirect to project view.

3 years agoAdd metrics to get issues by repository (#17225)
Romain [Tue, 5 Oct 2021 18:39:37 +0000 (20:39 +0200)]
Add metrics to get issues by repository (#17225)

3 years agoAdd specific event type to header (#17222)
John Olheiser [Tue, 5 Oct 2021 17:12:17 +0000 (12:12 -0500)]
Add specific event type to header (#17222)

* Add specific event type to header

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Change single to type

3 years agoFix stange behavior of DownloadPullDiffOrPatch in incorect index (#17223)
pricly-yellow [Tue, 5 Oct 2021 14:41:48 +0000 (21:41 +0700)]
Fix stange behavior of DownloadPullDiffOrPatch in incorect index (#17223)

Fix GetPullRequestByIndex by validate index > 1

Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>
Co-authored-by: a1012112796 <1012112796@qq.com>
3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 5 Oct 2021 00:25:07 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 4 Oct 2021 00:25:03 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

3 years agoAdd metrics to get issues by label (#17201)
Romain [Sun, 3 Oct 2021 22:46:44 +0000 (00:46 +0200)]
Add metrics to get issues by label (#17201)

* Add metrics to get issues by label

* Add comment on IssueByLabelCount

* Code review - Unify "AS" in SQL (#17201)

* Code review - Remove useless join (#17201)

* Code review - Disable issue_by_label by default in settings (#17201)

* use e

* restore empty line

* update docs

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
3 years agoFix typo in app.example.ini (#17213)
Petr Vaněk [Sun, 3 Oct 2021 22:46:20 +0000 (00:46 +0200)]
Fix typo in app.example.ini (#17213)