11902 Commits

Author SHA1 Message Date
f5845e6497 Changelog for 1.15.4 v1.15.4 2021-10-08 14:01:42 -04:00
c927ebd119 API: don't allow merged PRs to be reopened () 2021-10-08 13:54:26 -04:00
245596e130 don't try to interpret treepath as hash ()
...when path contains no hash-path-separator ('/')

This is a workaround to .

Entering this case when `path` does not contain a '/' does not really
make sense, as that means the tree path is empty, but this case is only
entered for routes that expect a non-empty tree path.

Treepaths like <40-char-dirname>/<filename> will still fail,
but hopefully don't occur that often. A more complete fix that avoids
this case too is outlined in , but too big of a change to backport
2021-10-08 13:53:54 -04:00
1c3ae6d05e Fix incorrect repository count on organization tab of dashboard ()
Fixes 
2021-10-08 17:33:16 +08:00
a1e57ebe6b Fix unwanted team review request deletion () ()
Add missing issue_id = ? to where clause
Fixes 
2021-10-07 23:58:13 +02:00
73ae93b007 CI: migrate from 'plugins/s3:1' to 'woodpeckerci/plugin-s3:latest' () ()
- 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
2021-10-07 22:02:07 +02:00
dc030f64a7 Remove dead badge on README.md () 2021-10-07 15:40:11 -04:00
6e0a08d753 Fix broken Activities link in team dashboard () ()
Remove '/' suffix from organization dashboard link

Fixes 
2021-10-07 20:58:59 +02:00
7b1153e943 API pull's head/base have correct permission() ()
* for all pull requests API return permissions of caller
* for all webhook return empty permissions

Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>

* Fix incorrect error handler

Co-authored-by: delvh <dev.lh@web.de>

* Fix wrong assumption in tests

* Change paramenter name to doer to indicate source

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

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: 6543 <6543@obermui.de>
2021-10-07 12:39:23 +03:00
6995be66e7 Fix stange behavior of DownloadPullDiffOrPatch in incorect index () ()
Fix GetPullRequestByIndex by validate index > 1

Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>
Co-authored-by: a1012112796 <1012112796@qq.com>
2021-10-05 20:16:22 +02:00
28971c7c15 Check user instead of organization when creating a repo from a template via API () ()
* Check user instead of organization

* Enforce that only admins can copy a repo to another user

Co-authored-by: Ion Jaureguialzo Sarasola <ion@jaureguialzo.com>
2021-10-01 10:16:28 +02:00
eb5e6f09eb upgrade xorm to v1.2.5 () () 2021-09-30 07:03:42 +01:00
bf6264c1db fix sprintf verbs in locales ()
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

Co-authored-by: 6543 <6543@obermui.de>
2021-09-30 12:03:21 +08:00
5b6b7e79cf Fix missing repo link in issue/pull assigned emails () ()
Backport 

There was a mistake in the template file: `templates/mail/issue/assigned.tmpl`
where the repourl was generated from a non-existent release instead of the issue.

This PR changes this to use the issue but also ensure that the issue repo is loaded.

It also slightly improves the English and the Russian locale string.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2021-09-30 01:21:12 +02:00
766272b154 Fix bug of get context user () ()
Co-authored-by: 6543 <6543@obermui.de>
2021-09-28 15:42:43 +02:00
4707d4b8a9 Nicely handle missing user in collaborations () ()
Backport 

It is possible to have a collaboration in a repository which refers to a no-longer
existing user. This causes the repository transfer to fail with an unusual error.

This PR makes `repo.getCollaborators()` nicely handle the missing user by ghosting
the collaboration but also adds consistency check. It also adds an
Access consistency check.

Fix 

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

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2021-09-28 07:41:12 +01:00
4b8b214108 Create doctor command to fix repo_units broken by dumps from 1.14.3-1.14.6 () ()
Backport 

There was a serious issue with the `gitea dump` command in 1.14.3-1.14.6 which led to corruption of the `config` field of the `repo_unit` table. 

This PR adds a doctor command to attempt to fix the broken repo_units. Users affected by  should run:

```
gitea doctor --fix --run fix-broken-repo-units
```

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-27 18:30:11 +01:00
ebae7e1512 Add Horizontal scrollbar to inner menu on Chrome () () 2021-09-27 12:44:22 -04:00
122917f4d5 Fix wrong i18n keys () ()
Co-authored-by: 6543 <6543@obermui.de>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-09-26 08:25:12 +08:00
9cf5739c0f correct transaction ending ()
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
2021-09-25 16:45:39 +01:00
4b6556565f Prevent panic in Org mode HighlightCodeBlock () ()
Backport 

When rendering source in org mode there is a mistake in the highlight code that
causes a panic.

This PR fixes this.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-24 14:29:47 +01:00
7ce938b6c7 Changelog 1.15.3 ()
## [1.15.3](https://github.com/go-gitea/gitea/releases/tag/v1.15.3) - 2021-09-19

* ENHANCEMENTS
  * Add fluid to ui container class to remove margin () ()
  * Add caller to cat-file batch calls () ()
* BUGFIXES
  * Render full plain readme. () ()
  * Upgrade xorm to v1.2.4 ()
  * Fix bug of migrate comments which only fetch one page () ()
  * Do not show issue context popup on external issues () ()
  * Decrement Fork Num when converting from Fork () ()
  * Correctly rollback in ForkRepository () ()
  * Fix missing close in WalkGitLog () ()
  * Add prefix to SVG id/class attributes () ()
  * Fix bug of migrated repository not index () ()
  * Skip AllowedUserVisibilityModes validation on update user if it is an organisation () ()
  * Fix storage Iterate bug and Add storage doctor to delete garbage attachments () ()
  * Fix issue with issue default mail template () ()
  * Ensure that rebase conflicts are handled in updates () ()
  * Prevent panic on diff generation () ()

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
v1.15.3
2021-09-20 12:02:52 +08:00
6139834e76 Add caller to cat-file batch calls () ()
Some people still appear to report unclosed cat-files. This PR simply adds the caller
to the process descriptor for the CatFileBatch and CatFileBatchCheck calls.

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-09-20 00:07:35 +08:00
b673a24ee6 Render full plain readme. () ()
Backport 

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2021-09-19 22:01:19 +08:00
fd35f56e87 Fix bug of migrate comments which only fetch one page () ()
* Fix bug of migrate comments which only fetch one page

* add next page to trace

Co-authored-by: zeripath <art27@cantab.net>

Co-authored-by: zeripath <art27@cantab.net>
2021-09-15 14:01:54 -04:00
1f8df5dd89 Upgrade xorm to v1.2.4 () 2021-09-15 23:27:46 +08:00
6a025d8b4a Do not show issue context popup on external issues () ()
Backport 

The issues pop-up context cannot work for external issues - therefore do not show
these.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-15 17:38:20 +08:00
270c7f36db Correctly rollback in ForkRepository () ()
Backport 

The rollback functionality in
services/repository/repository.go:ForkRepository is incorrect and could
lead to a deadlock as it uses DeleteRepository to delete the rolled-back
repository - a function which creates its own transaction.

This PR adjusts the rollback function to only use RemoveAll as any
database changes will be automatically rolled-back. It also handles
panics and adjusts the Close within WithTx to ensure that if there is a
panic the session will always be closed.

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-09-15 08:42:09 +03:00
0e448fb96d Decrement Fork Num when converting from Fork () ()
Backport 

When converting repositories from forks to normal the root NumFork needs to be
decremented too.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-15 10:05:47 +08:00
659b946eda Fix missing close in WalkGitLog () ()
Backport 

When the external context is cancelled it is possible for the
GitLogReader to not itself be Closed.

This PR does three things:

1. Instead of adding a plain defer it wraps the `g.Close` in a func as
`g` may change.
2. It adds the missing explicit g.Close - although the defer fix makes
this unnecessary.
3. It passes down the external context as the base context for the
GitLogReader meaning that the cancellation of the external context will
pass down automatically.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-10 17:46:06 +08:00
56ab5ec9ea Use filename as id/class prefix. () ()
Currently the svg minifier (`make svg`) rewrites all `id` and `class` attributes in svg files. Every file gets the ids `a, b, ...`. If multiple svgs with ids are used on a page these ids are conflicting and the results are broken images.

| minified ids | unique ids |
| - | - |
| ![grafik](https://user-images.githubusercontent.com/1666336/132579375-59d3996f-c4e5-43b8-8c8d-82280c90d9e3.png) | ![grafik](https://user-images.githubusercontent.com/1666336/132579413-05bf9285-4e3b-4d0d-8f95-90b212405b05.png) |

This PR adds a prefix (the filename) to every id/class.

Follow up problem: Because we embed svg images there are duplicated ids if one svg image is used multiple times on a page. As those ids refer to the same content it may be no real problem because browser handle that fine.
2021-09-09 10:47:28 +01:00
3b13c5d41a Fix bug of migrated repository not index () ()
Fix , 

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-09-09 07:02:22 +01:00
d27f061863 Skip AllowedUserVisibilityModes validation on update user if it is an organisation () ()
if AllowedUserVisibilityModes allow only public & limited, and orgs can be private, a user can create a repo to that organisation whitch will result in an update of the user. On this call the user is validaten and will be rejected since private is not allowed, but its not an user its an valid org ...

Co-authored-by: Alexey 〒erentyev <axifnx@gmail.com>

Co-authored-by: Alexey 〒erentyev <axifnx@gmail.com>
2021-09-08 23:58:00 +08:00
07489d0405 Fix storage Iterate bug and Add storage doctor to delete garbage attachments () ()
* Fix storage Iterate bug and Add storage doctor to delete garbage attachments

* Close object when used
2021-09-07 19:39:05 +01:00
30708d9ffe Fix issue with issue default mail template () ()
Backport 

The mail template rendering was failing with the error -
`...vices/mailer/mail.go:301:composeIssueCommentMessages() [E] ExecuteTemplate [issue/default/body]: template: issue/default:65:10: executing "issue/default" at <.i18n.Tr>: can't evaluate field i18n in type *models.Comment`

The issue was the template variable i18n is available in the outer scope.

Fix 

Co-authored-by: 6543 <6543@obermui.de>
2021-09-07 10:06:59 +08:00
1b08dfeacf Add fluid to ui container class to remove margin () ()
Co-authored-by: Stanley Hu <stanthetiger@yahoo.com>
2021-09-07 03:37:32 +02:00
e5ded0ee19 Ensure that rebase conflicts are handled in updates () ()
Backport 

PR  did not update the error handlers to handle conflict errors relating
to rebases. This PR adds them.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-05 18:54:13 +02:00
a384109244 Prevent panic on diff generation () ()
Backport 

The lastLeftIdx should be reset at the same time as creating a new section otherwise
it is possible for a second addition to end up attempting to read a nil entry.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-05 12:17:42 +02:00
67ceb61fe3 Changelog 1.15.2 ()
## [1.15.2](https://github.com/go-gitea/gitea/releases/tag/v1.15.2) - 2021-09-03

* BUGFIXES
  * Add unique constraint back into issue_index ()
  * Close storage objects before cleaning () ()

Signed-off-by: Andrew Thornton <art27@cantab.net>
v1.15.2
2021-09-03 12:50:32 +01:00
5cb5101720 Close storage objects before cleaning () ()
Backport 

Storage.Iterate provides the path and an open object. On windows using
local storage means that the objects will be locked thus preventing clean
from deleting them.

This PR simply closes the objects early.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-03 12:17:07 +01:00
6f261fdf47 Add unique constraint back into issue_index ()
There is a flaw in  where it was missed that although xorm will
not add a primary key to a table during syncing, it will remove an
unique constraint.

Users upgrading from 1.15.0 to 1.15.1 will therefore lose the unique
constraint that makes this table work unless they run `gitea doctor
recreate-table issue_index`.  Postgres helpfully warns about this
situation but MySQL does not.

Main/1.16-dev is not affected by this issue as there is a migration that
does the above recreation by default. Users moving directly to 1.15.1
from 1.14.x or lower are also not affected.

Whilst we could force all users who ran 1.15.0 to do the above
recreate-table call, this PR proposes an alternative: Just add the
unique constraint back in for 1.15.x. This won't have any long term
effects - just some wasted space for the unnecessary index.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-03 17:35:18 +08:00
3365611f06 Changelog 1.15.1 ()
## [1.15.1](https://github.com/go-gitea/gitea/releases/tag/v1.15.1) - 2021-09-02

* BUGFIXES
  * Allow BASIC authentication access to /:owner/:repo/releases/download/* () ()
  * Prevent leave changes dialogs due to autofill fields () ()
  * Ignore review comment when ref commit is missed () ()
  * Fix wrong attachment removal () ()
  * Gitlab Migrator: dont ignore reactions of last request () ()
  * Correctly return the number of Repositories for Organizations () ()
  * Test if LFS object is accessible () ()
  * Fix git.Blob.DataAsync(): close pipe since we return a NopCloser () ()
  * Fix dump and restore respository () ()
  * Repare and Improve GetDiffRangeWithWhitespaceBehavior () ()
  * Fix wiki raw commit diff/patch view () ()
  * Ensure wiki repos are all closed () ()
  * List limited and private orgs if authenticated on API () ()
  * Simplify split diff view generation and remove JS dependency () ()
  * Ensure that the default visibility is set on the user create page () ()
  * In Render tolerate not being passed a context () ()
  * Upgrade xorm to v1.2.2 () & Add test to ensure that dumping of login sources remains correct () ()
  * Report the correct number of pushes on the feeds () ()
  * Add primary_key to issue_index () ()
  * Prevent NPE on empty commit () ()
  * Fix branch pagination error () ()
  * Add missing return to handleSettingRemoteAddrError () ()
  * Remove spurious / from issues.opened_by ()
  * Ensure that template compilation panics are sent to the logs () ()
  * Update caddyserver/certmagic () ()

Signed-off-by: Andrew Thornton <art27@cantab.net>
v1.15.1
2021-09-02 18:23:40 +01:00
ceae89c8c7 Allow BASIC authentication access to /:owner/:repo/releases/download/* () ()
Backport 

Duplicate  to allow access to releases download through BASIC authentication.

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-02 12:34:49 -04:00
8f300781ad Prevent leave changes dialogs due to autofill fields () ()
Backport 

Add ignore-dirty to /user/settings/account
Add autocomplete="off" to push_mirror_address form on /:owner/:repo/settings

Fix 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-02 17:00:20 +01:00
8b132bdec6 Ignore review comment when ref commit is missed () ()
backport 
2021-09-02 11:51:32 +01:00
e70b679d21 Fix wrong attachment removal () ()
Backport 
2021-09-02 06:50:11 +01:00
02de43236a Gitlab Migrator: dont ignore reactions of last request () ()
Backport 

Fix bug related to early breaking when migrating reactions.

Co-authored-by: 6543 <6543@obermui.de>
2021-09-01 17:52:38 -04:00
f949f9e9c5 Correctly return the number of Repositories for Organizations () ()
Backport 

Calculate and return the number of Repositories on the dashboard
Organization list.

This PR restores some of the logic that was removed in  to
calculate the number of repos on the dashboard orgs list.

Fix 
Replaces 

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-09-01 19:20:35 +02:00
cbe3ca5d0b Test if LFS object is accessible () ()
* Test if object is accessible.

* Added more logging.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2021-08-31 17:58:39 +02:00
3ac1f35349 List limited and private orgs if authenticated on API () () 2021-08-31 12:49:02 +02:00