]> source.dussan.org Git - gitea.git/log
gitea.git
4 years agoFix Fomatic Build (#13593)
6543 [Mon, 16 Nov 2020 23:01:11 +0000 (00:01 +0100)]
Fix Fomatic Build (#13593)

4 years agoChangelog for v1.12.6 (#13152) v1.12.6
Lauris BH [Mon, 16 Nov 2020 06:57:34 +0000 (08:57 +0200)]
Changelog for v1.12.6 (#13152)

* Changelog for v1.12.6

* Update changelog

* Update CHANGELOG.md

* Update changelog

* Sorry for unrelated changes :]

Co-authored-by: 6543 <6543@obermui.de>
* Update CHANGELOG.md

Co-authored-by: 6543 <6543@obermui.de>
* Update CHANGELOG.md

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

* add future PRs

Co-authored-by: 6543 <6543@obermui.de>
4 years agoAPI: Fix GetQueryBeforeSince (#13559) (#13560)
6543 [Sun, 15 Nov 2020 18:12:23 +0000 (19:12 +0100)]
API: Fix GetQueryBeforeSince (#13559) (#13560)

* API: Fix GetQueryBeforeSince

* CI.restart()

Co-authored-by: zeripath <art27@cantab.net>
4 years ago[API] Only Return Json (#13511) (#13564)
6543 [Sun, 15 Nov 2020 16:28:48 +0000 (17:28 +0100)]
[API] Only Return Json (#13511) (#13564)

Backport #13511

Co-authored-by: zeripath <art27@cantab.net>
4 years agoPrevent git operations for inactive users (#13527) (#13537)
Lunny Xiao [Fri, 13 Nov 2020 02:51:32 +0000 (10:51 +0800)]
Prevent git operations for inactive users (#13527) (#13537)

* prevent git operations for inactive users

* Some fixes

* Deny push to the repositories which's owner is inactive

* deny operations also when user is ProhibitLogin

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoDisallow urlencoded new lines in git protocol paths if there is a port (#13521) ...
6543 [Wed, 11 Nov 2020 21:48:08 +0000 (22:48 +0100)]
Disallow urlencoded new lines in git protocol paths if there is a port (#13521) (#13525)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoPrevent panic on git blame by limiting lines to 4096 bytes at most (#13492)
6543 [Tue, 10 Nov 2020 07:59:38 +0000 (08:59 +0100)]
Prevent panic on git blame by limiting lines to 4096 bytes at most (#13492)

Fix #12440
Closes #13192

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
4 years agouse registry mirror for docker-in-docker (#13438) (#13446)
techknowlogick [Fri, 6 Nov 2020 20:43:19 +0000 (15:43 -0500)]
use registry mirror for docker-in-docker (#13438) (#13446)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
4 years ago[Vendor] update mvdan.cc/xurls v2.1.0 -> v2.2.0 (#13407) (#13408)
6543 [Tue, 3 Nov 2020 01:57:20 +0000 (02:57 +0100)]
[Vendor] update mvdan.cc/xurls v2.1.0 -> v2.2.0 (#13407) (#13408)

* Vendor: mvdan.cc/xurls v2.1.0 -> v2.2.0

* CI.restart()

4 years agoMigration failure during reaction migration from gitea (#13344) (#13346)
techknowlogick [Thu, 29 Oct 2020 18:42:56 +0000 (14:42 -0400)]
Migration failure during reaction migration from gitea (#13344) (#13346)

* Migration failure during reaction migration from gitea (#13344)

* Migrating reactions is just not that important

A failure during migrating reactions should not cause failure of
migration.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* When checking issue reactions check the correct permission

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Delete gitea_downloader.go

* Backport #13349

Unfortunately my final push to #13344 didn't register - or I failed to push it properly. GetIssueCommentReactions in routers/api/v1/repo/issue_reaction.go also makes the same mistake.

Co-authored-by: zeripath <art27@cantab.net>
4 years agoRemove obsolete change of email on profile page (#13341) (#13348)
techknowlogick [Thu, 29 Oct 2020 07:52:27 +0000 (03:52 -0400)]
Remove obsolete change of email on profile page (#13341) (#13348)

* Remove obsolete change of email on profile page

The change email on the account profile page is out-of-date
and unnecessary.

Changing email should be done using the account page.

Fix #13336

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoAdd migrated pulls to pull request task queue (#13331) (#13335)
zeripath [Tue, 27 Oct 2020 23:44:24 +0000 (23:44 +0000)]
Add migrated pulls to pull request task queue (#13331) (#13335)

Backport #13331

Fix #13321

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoDeny wrong pull (#13308) (#13327)
M4RKUS-11111 [Tue, 27 Oct 2020 18:35:28 +0000 (19:35 +0100)]
Deny wrong pull (#13308) (#13327)

* Deny wrong pull

* Update routers/api/v1/repo/pull.go

Co-authored-by: Markus <git+markus@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoAttempt to handle unready PR in tests (#13305) (#13311)
zeripath [Mon, 26 Oct 2020 00:46:50 +0000 (00:46 +0000)]
Attempt to handle unready PR in tests (#13305) (#13311)

Backport #13305

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoFix initial commit page & binary munching problem (#13249) (#13259)
zeripath [Thu, 22 Oct 2020 14:30:19 +0000 (15:30 +0100)]
Fix initial commit page & binary munching problem (#13249) (#13259)

Backport #13249

* Fix initial commit page

Unfortunately as a result of properly fixing ParsePatch the hack that
used git show <initial_commit_id> to get the diff for this failed.

This PR fixes this using the "super-secret" empty tree ref to make the
diff against.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Also fix #13248

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update services/gitdiff/gitdiff.go

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: 6543 <6543@obermui.de>
4 years agoUpdate heatmap fixtures to restore tests (#13224) (#13226)
6543 [Tue, 20 Oct 2020 22:39:42 +0000 (00:39 +0200)]
Update heatmap fixtures to restore tests (#13224) (#13226)

`the hotfix day`

4 years agoFix diff skipping lines (#13157)
zeripath [Fri, 16 Oct 2020 21:09:25 +0000 (22:09 +0100)]
Fix diff skipping lines (#13157)

* Fix diff skipping lines

Backport #13154

ParsePatch previously just skipped all lines that start with "+++ " or "--- "
and makes no attempt to see these lines in context.

This PR rewrites ParsePatch to pay attention to context and position
within a patch, ensuring that --- and +++ are only skipped if
appropriate.

This PR also fixes several issues with incomplete files.

Fix https://codeberg.org/Codeberg/Community/issues/308
Fix #13153

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

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

* simplify error handling

Signed-off-by: Andrew Thornton <art27@cantab.net>
* never return io.EOF

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoFinally fix diff names (#13136) (#13139)
zeripath [Wed, 14 Oct 2020 11:27:21 +0000 (12:27 +0100)]
Finally fix diff names (#13136) (#13139)

Backport #13136

it is possible to have an ambiguous line here.

if they needed to be and if one was quoted then both would be.

Both of these were wrong.

I have now discovered `--src-prefix` and `--dst-prefix` which
means that we can set this in such a way to force the git diff
to always be unambiguous.

Therefore this PR rollsback most of the changes in #12771 and
uses these options to fix this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoReturn 404 not 500 from API if team does not exist (#13118) (#13119)
zeripath [Mon, 12 Oct 2020 21:15:44 +0000 (22:15 +0100)]
Return 404 not 500 from API if team does not exist (#13118) (#13119)

Backport #13118

If team does not exist expect ErrTeamNotExist not ErrUserNotEXist

Fix #11336

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years ago[Backport] Prohibit automatic downgrades (#13108) (#13111)
6543 [Mon, 12 Oct 2020 18:24:43 +0000 (20:24 +0200)]
[Backport] Prohibit automatic downgrades (#13108) (#13111)

* Prohibit automatic downgrades

* do not only log, print to stderr too

* Update models/migrations/migrations.go

* Update models/migrations/migrations.go

Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
* a nit

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com>
4 years agoBackport Migration Option AuthToken (#13101)
6543 [Mon, 12 Oct 2020 06:14:02 +0000 (08:14 +0200)]
Backport Migration Option AuthToken (#13101)

fix #13085

Backport #12862
Backport Parts of #12672

4 years agoFix attachments list in edit comment (#13036) (#13097)
zeripath [Mon, 12 Oct 2020 04:05:21 +0000 (05:05 +0100)]
Fix attachments list in edit comment (#13036) (#13097)

Backport #13036

#11141 broke the appearance of dropzone attachments when editting
comments causing poorly updating lists.

This PR fixes this.

Fix #12583

Signed-off-by: Andrew Thornton art27@cantab.net
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoMigration Tool: Backport GitLab Label Color Normalizer (#12793) (#13100)
6543 [Sun, 11 Oct 2020 20:56:51 +0000 (22:56 +0200)]
Migration Tool: Backport GitLab Label Color Normalizer (#12793) (#13100)

fix bug mentioned in #13085

backport of #12793

4 years agoLog the underlying panic in runMigrateTask (#13096) (#13098)
zeripath [Sun, 11 Oct 2020 18:51:33 +0000 (19:51 +0100)]
Log the underlying panic in runMigrateTask (#13096) (#13098)

Backport #13096

If there is a panic during runMigrateTask we should capture and log the underlying
panic error.

This PR ensures that the panic is logged and captured as part of the task message.

Fix #13095

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoFix deadlock when deleting team user (#13093)
zeripath [Sat, 10 Oct 2020 19:48:20 +0000 (20:48 +0100)]
Fix deadlock when deleting team user (#13093)

Backport #13092

`models.getUserRepoPermission(...)` calls `HasOrgVisible` which
uses `models.x` potentially outside of the transaction `e` provided
as an argument to `getUserRepoPermission`.

This PR switches to use `hasOrgVisible(e, ...)`.

Fix #12983

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoFix error create comment on outdated file (#13041) (#13042)
6543 [Tue, 6 Oct 2020 06:38:08 +0000 (08:38 +0200)]
Fix error create comment on outdated file (#13041) (#13042)

* FIX

* more specific

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoFix repository create/delete event webhooks (#13008) (#13027)
James Lakin [Sun, 4 Oct 2020 21:42:03 +0000 (21:42 +0000)]
Fix repository create/delete event webhooks (#13008) (#13027)

4 years agoFix 500 on README in submodule (#13006) (#13016)
techknowlogick [Fri, 2 Oct 2020 14:39:14 +0000 (10:39 -0400)]
Fix 500 on README in submodule (#13006) (#13016)

If a README file is a symlink to a submodule Gitea the view branch page
will return a 500.

The underlying problem is a missed conversion of an
plumbing.ErrObjectNotFound in git/tree_blob.go.

Fix #12599

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoChangelog 1.12.5 (#13002) v1.12.5
John Olheiser [Thu, 1 Oct 2020 18:35:22 +0000 (13:35 -0500)]
Changelog 1.12.5 (#13002)

* Changelog 1.12.5

Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: techknowlogick <matti@mdranta.net>
* Apply suggestions from code review

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
4 years agoallow U2F with default settings for gitea in subpath (#12990) (#13001)
techknowlogick [Thu, 1 Oct 2020 17:22:49 +0000 (13:22 -0400)]
allow U2F with default settings for gitea in subpath (#12990) (#13001)

* allow U2F with default settings for gitea in subpath

* use trim suffix

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoPrevent empty div when editing comment (#12404) (#12991)
techknowlogick [Thu, 1 Oct 2020 01:25:57 +0000 (21:25 -0400)]
Prevent empty div when editing comment (#12404) (#12991)

* Prevent empty div when editing comment

The template for attachments needs to remove whitespace and return empty when there are no attachments.

Fix #10220

Co-authored-by: zeripath <art27@cantab.net>
4 years agoMirror: Update DB on Address-Update too (#12964) (#12967)
6543 [Mon, 28 Sep 2020 19:52:13 +0000 (21:52 +0200)]
Mirror: Update DB on Address-Update too (#12964) (#12967)

* Mirror: Update DB on Address-Update too (#12964)

* Mirror: Update DB on Address-Update too

* new name for function to better describe

* fix lint

4 years agoAllow extended config on cron settings (#12939) (#12943)
zeripath [Fri, 25 Sep 2020 15:19:20 +0000 (16:19 +0100)]
Allow extended config on cron settings (#12939) (#12943)

Backport #12939

Fix #12934

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoOpen transaction when adding Avatar email-hash pairs to the DB (#12577) (#12940)
zeripath [Thu, 24 Sep 2020 22:36:26 +0000 (23:36 +0100)]
Open transaction when adding Avatar email-hash pairs to the DB (#12577) (#12940)

Backport #12577

When adding Avatar email-hash pairs we simply want the DB table to
represent a Set. We don't care if the hash-pair is already present,
so we just simply Insert and ignore the error.

Unfortunately this seems to cause some DBs to log the duplicate
insert to their logs - looking like a bug a in Gitea.

Now, there is no standard way in SQL to say Insert but if there's
an error ignore it. MySQL has INSERT IGNORE, PostgreSQL >= 9.5 has
INSERT ... ON CONFLICT DO NOTHING, but I do not believe that SQLite
or MSSQL have variants.

This PR places the insert in a transaction which we are happy to fail
if there is an error - hopefully this will stop the unnecessary
logging.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoFix ListUserOrgs (#12910) (#12915)
赵智超 [Mon, 21 Sep 2020 05:04:33 +0000 (13:04 +0800)]
Fix ListUserOrgs (#12910) (#12915)

fix #12891

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
4 years agoUpdate only the repository columns that need updating (#12900) (#12912)
zeripath [Mon, 21 Sep 2020 01:06:23 +0000 (02:06 +0100)]
Update only the repository columns that need updating (#12900) (#12912)

Backport #12900

We should only update is_empty, default_branch and updated time columns
during commitRepoAction and not update other columns as we risk
overwriting incorrect information.

Fix #11823
Fix #10536

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoFix panic when adding long comment (#12892) (#12894)
mrsdizzie [Fri, 18 Sep 2020 20:45:00 +0000 (16:45 -0400)]
Fix panic when adding long comment (#12892) (#12894)

Previous PR #12881 causes out of bounds panic by working on wrong string.

4 years agoConvert User expose ID each time (#12855) (#12883)
6543 [Fri, 18 Sep 2020 16:56:16 +0000 (18:56 +0200)]
Convert User expose ID each time (#12855) (#12883)

* Convert User expose ID each time (#12855)

* git blame tells me a lot of gitea things happen here around 2018, add header

* move user code int its own file

* expose user id

* adopt things from APIFormat

* fix test

* CI.restart()

* No Refactor

* CI.restart()

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoAdd size limit for content of comment on action ui (#12881) (#12890)
赵智超 [Fri, 18 Sep 2020 11:58:49 +0000 (19:58 +0800)]
Add size limit for content of comment on action ui (#12881) (#12890)

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoFix pgsql migration test (#12844) (#12884)
Lunny Xiao [Fri, 18 Sep 2020 08:28:13 +0000 (16:28 +0800)]
Fix pgsql migration test (#12844) (#12884)

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
4 years agoFix [API] CreateRepo missing information (#12848) (#12867)
6543 [Fri, 18 Sep 2020 05:58:04 +0000 (07:58 +0200)]
Fix [API] CreateRepo missing information (#12848) (#12867)

* Fix [API] [Bug] CreateRepo missing information (#12848)

* Fix [API] [Bug] CreateRepo missing information

* add code comment

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* CI.restart()

* CI.restart()

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoSupport slashes in release tags (#12864) (#12882)
zeripath [Thu, 17 Sep 2020 20:33:48 +0000 (21:33 +0100)]
Support slashes in release tags (#12864) (#12882)

Backport #12864

Fix #12861

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoFix migration v111 (#12868)
Lunny Xiao [Wed, 16 Sep 2020 07:37:04 +0000 (15:37 +0800)]
Fix migration v111 (#12868)

4 years agoEscape more things that are passed through str2html (#12622) (#12850)
zeripath [Tue, 15 Sep 2020 22:43:10 +0000 (23:43 +0100)]
Escape more things that are passed through str2html (#12622) (#12850)

Backport #12622

* Escape more things that are passed through str2html

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Bloody editors!

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update routers/user/oauth.go

4 years agoFix notifications page links (#12838) (#12853)
zeripath [Tue, 15 Sep 2020 16:53:30 +0000 (17:53 +0100)]
Fix notifications page links (#12838) (#12853)

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoOn Migration respect old DefaultBranch (#12843) (#12858)
6543 [Tue, 15 Sep 2020 16:12:07 +0000 (18:12 +0200)]
On Migration respect old DefaultBranch (#12843) (#12858)

* On Migration respect old DefaultBranch

* add DefaultBranch int test set

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoStop cloning unnecessarily on PR update (#12839) (#12852)
zeripath [Tue, 15 Sep 2020 10:09:25 +0000 (11:09 +0100)]
Stop cloning unnecessarily on PR update (#12839) (#12852)

Backport #12839

Fix #12740

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoRemove double escape on labels addition in comments (#12809) (#12810)
techknowlogick [Fri, 11 Sep 2020 04:56:12 +0000 (00:56 -0400)]
Remove double escape on labels addition in comments (#12809) (#12810)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoFix "only mail on mention" bug (#12775) (#12789)
赵智超 [Thu, 10 Sep 2020 08:32:54 +0000 (16:32 +0800)]
Fix "only mail on mention" bug (#12775) (#12789)

* fix mail mention bug

fix #12774

Signed-off-by: a1012112796 <1012112796@qq.com>
* fix test

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoFix yet another bug with diff file names (#12771) (#12776)
zeripath [Wed, 9 Sep 2020 18:03:54 +0000 (19:03 +0100)]
Fix yet another bug with diff file names (#12771) (#12776)

Backport #12771

Following further testing it has become apparent that the diff line
cannot be used to determine filenames for diffs with any sort of predictability
the answer therefore is to use the other lines that are provided with a diff

Fix #12768

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agogitea dump: include version & Check InstallLock (#12760) (#12762)
6543 [Tue, 8 Sep 2020 00:44:45 +0000 (02:44 +0200)]
gitea dump: include version &  Check InstallLock (#12760) (#12762)

* gitea dump: include version

* Check InstallLock

4 years agoRepoInit Respect AlternateDefaultBranch (#12746) (#12751)
6543 [Sun, 6 Sep 2020 22:03:50 +0000 (00:03 +0200)]
RepoInit Respect AlternateDefaultBranch (#12746) (#12751)

4 years agoFix Avatar Resize (resize algo NearestNeighbor -> Bilinear) (#12745) (#12750)
6543 [Sun, 6 Sep 2020 21:14:59 +0000 (23:14 +0200)]
Fix Avatar Resize (resize algo NearestNeighbor -> Bilinear) (#12745) (#12750)

* Update Vendor github.com/nfnt/resize

* switch resize algo NearestNeighbor -> Bilinear

4 years ago[Backport] Fix go1.15 lint error in modules/public/public.go (#12707) (#12708)
6543 [Fri, 4 Sep 2020 05:28:08 +0000 (07:28 +0200)]
[Backport] Fix go1.15 lint error in modules/public/public.go (#12707) (#12708)

* fix go1.15 lint error in modules/public/public.go

* CI.restart()

4 years agoChangelog for 1.12.4 release (#12687) v1.12.4
techknowlogick [Thu, 3 Sep 2020 21:00:13 +0000 (17:00 -0400)]
Changelog for 1.12.4 release (#12687)

Co-authored-by: zeripath <art27@cantab.net>
4 years ago[Backport] Fix comment broken issue ref dependence (#12651) (#12692)
6543 [Thu, 3 Sep 2020 09:23:36 +0000 (11:23 +0200)]
[Backport] Fix comment broken issue ref dependence (#12651) (#12692)

* deleteIssuesByRepoID: delete related CommentTypeRemoveDependency & CommentTypeAddDependency comments too

* Ignore ErrIssueNotExist on comment.LoadDepIssueDetails()

* CI.restart()

4 years agoMake default StaticRootPath compile time settable (#12371) (#12652)
6543 [Wed, 2 Sep 2020 23:12:24 +0000 (01:12 +0200)]
Make default StaticRootPath compile time settable (#12371) (#12652)

Make it possible to compile the default location of StaticRootPath independent from AppWorkPath

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoWhen reading expired sessions - expire them (#12686) (#12690)
techknowlogick [Wed, 2 Sep 2020 22:51:56 +0000 (18:51 -0400)]
When reading expired sessions - expire them (#12686) (#12690)

* When reading expired sessions - expire them

Update to latest macaron/session following merge of
https://gitea.com/macaron/session/pulls/11

Also remove old memory provider as 11 updates the memory provider to
make it unnecessary.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* and macaron/session/pulls/12

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoEscape provider name in oauth2 provider redirect (#12650)
6543 [Sun, 30 Aug 2020 22:55:19 +0000 (00:55 +0200)]
Escape provider name in oauth2 provider redirect (#12650)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
4 years agoMark Cache with ini tag (#12605) (#12611)
John Olheiser [Wed, 26 Aug 2020 15:53:14 +0000 (10:53 -0500)]
Mark Cache with ini tag (#12605) (#12611)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
4 years agoEscape Email in forgot_password.tmpl (#12610) (#12612)
John Olheiser [Wed, 26 Aug 2020 15:12:09 +0000 (10:12 -0500)]
Escape Email in forgot_password.tmpl (#12610) (#12612)

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agogo1.15 on windows (#12589) (#12593)
techknowlogick [Mon, 24 Aug 2020 22:38:47 +0000 (18:38 -0400)]
go1.15 on windows (#12589) (#12593)

We don't support go1.15 on 1.12.x branch, however this will allow users who chose to build with go1.15 on windows to be successful

4 years agoFix diff path unquoting (#12554) (#12575)
zeripath [Sun, 23 Aug 2020 13:58:09 +0000 (14:58 +0100)]
Fix diff path unquoting (#12554) (#12575)

Backport #12554

* Fix diff path unquoting

services/gitdiff/gitdiff.go whereby there it assumed that the path would
always be quoted on both sides

This PR simplifies the code here and uses fmt.Fscanf to parse the
strings as necessary.

Fix #12546

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

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoSkip SSPI authentication attempts for /api/internal (#12556) (#12559)
zeripath [Sat, 22 Aug 2020 21:09:14 +0000 (22:09 +0100)]
Skip SSPI authentication attempts for /api/internal (#12556) (#12559)

Backport #12556

SSPI fails badly on authentication attempts to /api/internal which
it can never succesfully authenticate.

Fix #11260

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
4 years agoDefault empty merger list to those with write permissions (#12535) (#12560)
zeripath [Sat, 22 Aug 2020 20:35:56 +0000 (21:35 +0100)]
Default empty merger list to those with write permissions (#12535) (#12560)

Backport #12535

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agomodels: break out of loop (#12386) (#12561)
zeripath [Sat, 22 Aug 2020 15:22:07 +0000 (16:22 +0100)]
models: break out of loop (#12386) (#12561)

Backport #12386

Co-authored-by: Lars Lehtonen <lars.lehtonen@gmail.com>
4 years agoImprove HTML escaping helper (#12562)
silverwind [Sat, 22 Aug 2020 12:36:56 +0000 (14:36 +0200)]
Improve HTML escaping helper (#12562)

The previous method did not escape single quotes which under some
circumstances can lead to XSS vulnerabilites and the fact that it
depends on jQuery is also not ideal. Replace it with a lightweight
module.

4 years agoPrevent NPE on commenting on lines with invalidated comments (#12549) (#12550)
zeripath [Fri, 21 Aug 2020 07:52:20 +0000 (08:52 +0100)]
Prevent NPE on commenting on lines with invalidated comments (#12549) (#12550)

* Prevent NPE on commenting on lines with invalidated comments

Only check for a review if we are replying to a previous review.

Prevent the NPE in #12239 by assuming that a comment without a Review is
non-pending.

Fix #12239

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add hack around to show the broken comments

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoRemove hardcoded ES indexername (#12521) (#12526)
John Olheiser [Wed, 19 Aug 2020 01:42:22 +0000 (20:42 -0500)]
Remove hardcoded ES indexername (#12521) (#12526)

Co-authored-by: Wim <wim@42.be>
4 years agoKeys should not verify revoked email addresses (#12486) (#12495)
zeripath [Mon, 17 Aug 2020 16:06:31 +0000 (17:06 +0100)]
Keys should not verify revoked email addresses (#12486) (#12495)

Backport #12486

Fix #6778

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoFix bug preventing transfer to private organization (#12497) (#12501)
techknowlogick [Mon, 17 Aug 2020 06:32:33 +0000 (02:32 -0400)]
Fix bug preventing transfer to private organization (#12497) (#12501)

* Fix bug preventing transfer to private organization

The code assessing whether a private organization was visible to a user before
allowing transfer was incorrect due to testing membership the wrong way round

This PR fixes this issue and renames the function performing the test to be
clearer.

Further looking at the API for transfer repository - no testing was
performed to ensure that the acting user could actually see the new
owning organization.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* change IsUserPartOfOrg everywhere

Co-authored-by: zeripath <art27@cantab.net>
4 years agoDo not add prefix on http/https submodule links (#12477) (#12479)
techknowlogick [Thu, 13 Aug 2020 15:53:40 +0000 (11:53 -0400)]
Do not add prefix on http/https submodule links (#12477) (#12479)

Fix #12345

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoFix ignored login on compare (#12476) (#12478)
techknowlogick [Wed, 12 Aug 2020 20:36:22 +0000 (16:36 -0400)]
Fix ignored login on compare (#12476) (#12478)

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoMatch GH with Commit page (#12425) (#12431)
techknowlogick [Wed, 5 Aug 2020 07:49:12 +0000 (03:49 -0400)]
Match GH with Commit page (#12425) (#12431)

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoFix incorrect error logging in Stats indexer and OAuth2 (#12387) (#12422)
techknowlogick [Tue, 4 Aug 2020 08:27:43 +0000 (04:27 -0400)]
Fix incorrect error logging in Stats indexer and OAuth2 (#12387) (#12422)

* Fix incorrect logging in oauth2.go

Fix #11945

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Handle ErrAlreadyInQueue in stats indexer

Fix #12380

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fixes type in error message of indexer

Add the missing character in the error message.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lieven Hollevoet <hollie@lika.be>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lieven Hollevoet <hollie@lika.be>
4 years ago[Vendor] upgrade google/go-github to v32.1.0 (#12361) (#12390)
6543 [Fri, 31 Jul 2020 16:02:23 +0000 (18:02 +0200)]
[Vendor] upgrade google/go-github to v32.1.0 (#12361) (#12390)

* upgrate go-github client to v32.1.0

* migrate

4 years agoRendoer emoji's of Commit message on feed-page (#12373)
6543 [Wed, 29 Jul 2020 21:09:47 +0000 (23:09 +0200)]
Rendoer emoji's of Commit message on feed-page (#12373)

4 years agoGit 2.28 no longer permits diff with ... on unrelated branches (#12370)
zeripath [Wed, 29 Jul 2020 16:42:22 +0000 (17:42 +0100)]
Git 2.28 no longer permits diff with ... on unrelated branches (#12370)

Backport #12364

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoChangelog v1.12.3 (#12356) v1.12.3
6543 [Tue, 28 Jul 2020 20:41:36 +0000 (22:41 +0200)]
Changelog v1.12.3 (#12356)

* Changelog v1.12.3

* better description for 12351

* @techknowlogick suggestions

4 years agoBackport to v1.12 for #12341 - Release date fix (#12351)
Richard Mahn [Tue, 28 Jul 2020 18:10:50 +0000 (14:10 -0400)]
Backport to v1.12 for #12341 - Release date fix (#12351)

* Backport for Issue #12341 PR #12343 - Release date fix

* Adds sleep for comparing times

* Fixes imports

* Fixes tests

4 years agoShow 404 page when release not found (#12328) (#12332)
techknowlogick [Sun, 26 Jul 2020 21:39:44 +0000 (17:39 -0400)]
Show 404 page when release not found (#12328) (#12332)

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 赵智超 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoBackport emoji fixes to 1.12 (#12327)
silverwind [Sat, 25 Jul 2020 16:50:57 +0000 (18:50 +0200)]
Backport emoji fixes to 1.12 (#12327)

* Fix emoji detection in certain cases (#12320)

* Fix emoji detection certain cases

Previous tests weren't complicated enough so there were some situations where emojis were't detected properly. Find the earliest occurance in addition to checking for the longest combination.

Fixes #12312

* ok spell bot

Co-authored-by: Lauris BH <lauris@nix.lv>
* Reduce emoji size (#12317)

* Reduce emoji size

Rendering should now pretty much match GitHub with 1.25em. I verified
that emojis don't increase the line height and removed unecessary size
overrides because now all emojis should appear similar in relation to
the font size.

* fix reaction hover

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
4 years agoFix double-indirection bug in logging IDs (#12294) (#12308)
techknowlogick [Thu, 23 Jul 2020 23:24:22 +0000 (19:24 -0400)]
Fix double-indirection bug in logging IDs (#12294) (#12308)

This PR fixes a bug in log.NewColoredIDValue() which led to a double
indirection and incorrect IDs being printed out.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: zeripath <art27@cantab.net>
4 years ago[ui] Link to pr list page on sidebar when view pr (#12256) (#12263)
techknowlogick [Thu, 16 Jul 2020 15:56:09 +0000 (11:56 -0400)]
[ui] Link to pr list page on sidebar when view pr (#12256) (#12263)

Fix #12254

Signed-off-by: a1012112796 <1012112796@qq.com>
Co-authored-by: 赵智超 <1012112796@qq.com>
4 years agoExtend Notifications API and return pinned notifications by default (#12164) (#12232)
zeripath [Mon, 13 Jul 2020 20:52:05 +0000 (21:52 +0100)]
Extend Notifications API and return pinned notifications by default (#12164) (#12232)

Backport #12164

This PR extends the notifications API to allow specific notification statuses to be searched for and to allow setting of notifications to statuses other than read.

By default unread and pinned statuses will be returned when querying for notifications - however pinned statuses will not be marked as read.

Close #12152

Signed-off-by: Andrew Thornton art27@cantab.net
4 years agoChangelog for v1.12.2 (#12214) v1.12.2
Lauris BH [Sat, 11 Jul 2020 16:53:26 +0000 (19:53 +0300)]
Changelog for v1.12.2 (#12214)

* Changelog for v1.12.2

* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
* Update CHANGELOG.md

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: mrsdizzie <info@mrsdizzie.com>
4 years agoDecrease the num_stars when deleting a repo (#11954) (#12188)
赵智超 [Wed, 8 Jul 2020 21:52:40 +0000 (05:52 +0800)]
Decrease the  num_stars when deleting a repo (#11954) (#12188)

* Decrease the  num_stars when deleting a repo

fix #11949

Signed-off-by: a1012112796 <1012112796@qq.com>
* Add migration

* use batch

* Apply suggestions from code review

Co-authored-by: Lauris BH <lauris@nix.lv>
* fix lint

* fix lint

* fix ci

* fix ci2

* add doctor

* duplicate code

* fix migration

* fix some nits

* add start

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoFix regression: Gitea commits API again returns commit summaries, not full messages...
techknowlogick [Wed, 8 Jul 2020 15:22:07 +0000 (11:22 -0400)]
Fix regression: Gitea commits API again returns commit summaries, not full messages  (#12186) (#12187)

Closes #12185

Co-authored-by: Kristian Antonsen <kristian@derfor.dk>
4 years agoproperly set symbolic-ref HEAD when a repo is created with a non-master default branc...
techknowlogick [Wed, 8 Jul 2020 04:40:22 +0000 (00:40 -0400)]
properly set symbolic-ref HEAD when a repo is created with a non-master default branch (#12135) (#12182)

This fixes an issue I noticed with #10803: when you create a repo with a non-master default branch, gitea doesn't change the remote ref HEAD, so it still points at refs/heads/master. As a result, cloning my repos gives me error messages and doesn't check out the desired default branch, so I need to manually check it out after cloning.

Co-authored-by: xenofem <45297511+xenofem@users.noreply.github.com>
4 years agoTrim to 255 runes instead of bytes (#12150)
Jürgen Hötzel [Tue, 7 Jul 2020 21:35:52 +0000 (23:35 +0200)]
Trim to 255 runes instead of bytes (#12150)

* Trim to 255 runes instead of bytes

Prevents invalid UTF-8 encoding for Description and Website. Refs #7905

* Apply suggestions from code review

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
4 years agoEnsure Subkeys are verified (#12155) (#12168)
zeripath [Tue, 7 Jul 2020 00:13:18 +0000 (01:13 +0100)]
Ensure Subkeys are verified (#12155) (#12168)

Backport #12155

When attempting to verify subkeys the email address verification step
requires checking the emails however, these emails are not stored on
subkeys but instead on the primary key.

This PR will obtain the primaryKey and check against these emails too.

Fix #12128

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoUse hash of repo path, ref and entrypath as cache key (#12151) (#12161)
Lauris BH [Mon, 6 Jul 2020 08:51:45 +0000 (11:51 +0300)]
Use hash of repo path, ref and entrypath as cache key (#12151) (#12161)

4 years agoMultiple small admin dashboard fixes (#12153) (#12156)
zeripath [Sun, 5 Jul 2020 20:19:53 +0000 (21:19 +0100)]
Multiple small admin dashboard fixes (#12153) (#12156)

* Prevent (EXTRA string) comments in Task headers
* Redirect tasks started from monitor page back to monitor
* Fix #12107 - redirects from process cancel should use AppSubUrl
* When wrapping queues set the name correctly

Signed-off-by: Andrew Thornton <art27@cantab.net>
4 years agoRemove spurious logging (#12139) (#12148)
zeripath [Sun, 5 Jul 2020 16:09:13 +0000 (17:09 +0100)]
Remove spurious logging (#12139) (#12148)

Backport #12139

Unfortunately #10745 merged a spurious logging message. This PR removes this.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agotemplates/repo/empty.tmpl : fix repo setup instructions (#12147)
Andreas Shimokawa [Sun, 5 Jul 2020 12:56:10 +0000 (14:56 +0200)]
templates/repo/empty.tmpl : fix repo setup instructions (#12147)

Co-authored-by: codeberg <codeberg@codeberg.org>
Co-authored-by: zeripath <art27@cantab.net>
4 years ago Move EventSource to SharedWorker (#12095) (#12130)
zeripath [Sat, 4 Jul 2020 22:08:03 +0000 (23:08 +0100)]
 Move EventSource to SharedWorker (#12095) (#12130)

* Move EventSource to SharedWorker (#12095)

Backport #12095

Move EventSource to use a SharedWorker. This prevents issues with HTTP/1.1
open browser connections from preventing gitea from opening multiple tabs.

Also allow setting EVENT_SOURCE_UPDATE_TIME to disable EventSource updating

Fix #11978

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Bugfix for shared event source

For some reason our eslint configuration is not working correctly
and a bug has become apparent when trying to backport this to 1.12.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Re-fix #12095 again

Unfortunately some of the suggested changes to #12095 introduced
bugs which due to caching behaviour of sharedworkers were not caught
on simple tests.

These are as follows:

* Changing from simple for loop to use includes here:

```js
  register(port) {
    if (!this.clients.includes(port)) return;

    this.clients.push(port);

    port.postMessage({
      type: 'status',
      message: `registered to ${this.url}`,
    });
  }
```

The additional `!` prevents any clients from being added and should
read:

```js
    if (this.clients.includes(port)) return;
```

* Dropping the use of jQuery `$(...)` selection and using DOM
`querySelector` here:

```js
async function receiveUpdateCount(event) {
  try {
    const data = JSON.parse(event.data);

    const notificationCount = document.querySelector('.notification_count');
    if (data.Count > 0) {
      notificationCount.classList.remove('hidden');
    } else {
      notificationCount.classList.add('hidden');
    }

    notificationCount.text() = `${data.Count}`;
    await updateNotificationTable();
  } catch (error) {
    console.error(error, event);
  }
}
```

Requires that `notificationCount.text()` be changed to use `textContent`
instead.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
4 years agoFix ui bug in wiki commit page (#12089) (#12125)
赵智超 [Fri, 3 Jul 2020 04:49:55 +0000 (12:49 +0800)]
Fix ui bug in wiki commit page (#12089) (#12125)

* Fix ui bug in wiki commit page

TODO: Maybe we should allow wiki to have its own ``.editorconfig`` file.

Signed-off-by: a1012112796 <1012112796@qq.com>
* fix a small nit

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
4 years agoSet the base url when migrating from Gitlab using access token or username without...
zeripath [Thu, 2 Jul 2020 12:26:47 +0000 (13:26 +0100)]
Set the base url when migrating from Gitlab using access token or username without password (#11852) (#12104)

Backport #11852

When migrating from gitlab, set the baseUrl in NewGitlabDownloader when using an access token or username without password

Fix #11851

Co-authored-by: Gernot Eger <gernot.eger@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
4 years agoFix gitgraph branch continues after merge (#12044) (#12105)
zeripath [Thu, 2 Jul 2020 10:46:06 +0000 (11:46 +0100)]
Fix gitgraph branch continues after merge (#12044) (#12105)

Backport #12044

* Fix gitgraph branch continues after merge

After fixing the initial problem in #11981 another
problem has come to light...

Fix #11981 (part 2)

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update web_src/js/vendor/gitgraph.js

* Apply suggestions from code review

Co-authored-by: silverwind <me@silverwind.io>
4 years agoFix merge section in dark theme (#12086) (#12109)
Lauris BH [Thu, 2 Jul 2020 09:36:45 +0000 (12:36 +0300)]
Fix merge section in dark theme (#12086) (#12109)

Backport #12086

* Fix merge section in dark theme

* Fix lint