2093 Commits (58bdff53cd98e33791f91584d02887864aabc5c4)

Author SHA1 Message Date
Lunny Xiao 9d0dee88d2
fix table name typo on SQL (#5562)
* fix table name typo on SQL

* fix reserved word user when on mssql
6 years ago
Lunny Xiao fe55ab2a68 fix forgot removed records when deleting user (#5429)
* fix forgot removed records when deleting user

* fix migration

* fix rewritekey lock on sqlite

* remove unused codes
6 years ago
Jonas Franz e726e4b828 Add base repo nil check (#5555)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
6 years ago
Lunny Xiao b3b7598ec6 Improve performance of dashboard (#4977) 6 years ago
kolaente 6db7dbd333 Added test environment for mssql (#4282)
* Added test environment for m$sql

* Added template for test environment for m$sql

* Fix password

* Fix password (again)

* Fix password (again again)

* Fix db

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Ci trigger (Looking at you drone....)

* Create master database for mssql integration tests

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Create database only if master do not exist

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix mssql integration tests by using custom database "gitea"

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Moved defer

* bump xorm

* updated xorm

* Fixed build
6 years ago
Lunny Xiao b1f3685015 fix approvals limitation (#5521) 6 years ago
Jonas Franz 9681c83734 Approvals at Branch Protection (#5350)
* Add branch protection for approvals

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add required approvals

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add missing comments and fmt

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add type = approval and group by reviewer_id to review

* Prevent users from adding negative review limits

* Add migration for approval whitelists

Signed-off-by: Jonas Franz <info@jonasfranz.software>
6 years ago
Christopher 64680b72bd Fixing MSSQL timestamp type (#5511)
MSSQL is using the wrong type here which results in a strconv.ParseInt: parsing "2018-12-07T00:00:00Z": invalid syntax error.
The added datediff(SECOND, '19700101', x) results in the unix timestamp to be returned.

Signed-off-by: Christopher Dziomba <christopher.dziomba@gmail.com>
6 years ago
Lunny Xiao 284b0e12cb
fix code review on mssql (#5502) 6 years ago
Lunny Xiao 1b3404eaca fix forgot deletion of notification when delete repository (#5506) 6 years ago
Lunny Xiao 4b4453cb92 fix topic name length on database (#5493) 6 years ago
romankl 2d707fe5e6 ensure that the `closed_at` is set for closed (#5449)
right now the `closed_at` field for json responses is not filled during
the `APIIssue` creation for api responses.

For a closed issue you get a result like:
```json
"state":"open","comments":0,"created_at":"2018-11-29T16:39:24+01:00",
"updated_at":"2018-11-30T10:49:19+01:00","closed_at":null,
"due_date":null,"pull_request":null}
```
which has no information about the closing date. (which exists in the
db and ui)
with this PR the result changes to this:

```json
:null,"assignee":null,"assignees":null,
"state":"closed",
"comments":0,"created_at":"2018-11-29T16:43:05+01:00",
"updated_at":"2018-12-02T19:17:05+01:00",
"closed_at":"2018-12-02T19:17:05+01:00",
"due_date":null,"pull_request":null}
```

fixes: https://github.com/go-gitea/gitea/issues/5446
Signed-off-by: Roman <romaaan.git@gmail.com>
6 years ago
Lunny Xiao f80b4f46ae Fix repository deletion when there is large number of issues in it (#5426) 6 years ago
Lunny Xiao 2dc805c0c6
Milestone issues and pull requests (#5293)
* add milestone issues and pulls page instead of redirecting issues page

* add milestone when creating issue from milestone page

* refactor to merge similiar codes as a new function issues

* remove milestone info on milestone issues list

* fix missing params
6 years ago
Lunny Xiao eabbddcd98
Restrict permission check on repositories and fix some problems (#5314)
* fix units permission problems

* fix some bugs and merge LoadUnits to repoAssignment

* refactor permission struct and add some copyright heads

* remove unused codes

* fix routes units check

* improve permission check

* add unit tests for permission

* fix typo

* fix tests

* fix some routes

* fix api permission check

* improve permission check

* fix some permission check

* fix tests

* fix tests

* improve some permission check

* fix some permission check

* refactor AccessLevel

* fix bug

* fix tests

* fix tests

* fix tests

* fix AccessLevel

* rename CanAccess

* fix tests

* fix comment

* fix bug

* add missing unit for test repos

* fix bug

* rename some functions

* fix routes check
6 years ago
Lanre Adelowo 5e022a98e6 show only opened milestones on issues page milestone filter (#5051)
* show only opened milestones on issues page milestone filter

* update Godoc

* update Godoc everywhere

* update swagger

* use false instead of 0

* Add seccond ordering by ID for milestones where no deadline is set
6 years ago
kolaente 0dcf31ae49 Show review summary in pull requests (#5132) 6 years ago
Lunny Xiao 499bff43d9 dont' send assign webhooks when creating issue (#5365) 6 years ago
Florian Eitel d9b51a781c Migration fixes for gogs (0.11.66) to gitea (1.6.0) #5318 (#5341)
* Remove field from migration to support upgrades from older version

That will ensure the field does not get queried in the Select if it does
not exist yet:

```
[I] [SQL] SELECT "id", "repo_id", "index", "poster_id", "name", "content", "milestone_id", "priority", "assignee_id", "is_closed", "is_pull", "num_comments", "ref", "deadline_unix", "created_unix", "updated_unix
[...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: pq: column "ref" does not exist
```

see #5318

* Skip remove stale watcher migration if not required

Otherwise the migration will fail if executed from a older database
version without multiple IssueWatch feature.

```
2018/11/11 23:51:14 [I] [SQL] SELECT DISTINCT "issue_watch"."user_id", "issue"."repo_id" FROM "issue_watch" INNER JOIN issue ON issue_watch.issue_id = issue.id WHERE (issue_watch.is_watching = $1) LIMIT 50 []int
[...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: pq: relation "issue_watch" does not exist
```

see #5318
6 years ago
Lunny Xiao b3000ae623 Fix create team, update team missing units (#5188) 6 years ago
Lunny Xiao c5d098c32e fix bug when users have serval teams with different units on different repositories (#5307) 6 years ago
Jonas Bröms 599adde1bc Add option to disable automatic mirror syncing. (#5242)
Setting the interval to 0 will disable to automatic syncing.
6 years ago
Stanislav 078c404c3b Prometheus endpoint (#5256)
* Add prometheus collector and route

* dep ensure -add github.com/prometheus/client_golang/prometheus

* dep ensure -update github.com/golang/protobuf

* add metrics to reserved usernames

* add comment head in metrics package

* fix style imports

* add metrics settings

* add bearer token check

* mapping metrics configs

* fix lint

* update config cheat sheet

* update conf sample, typo fix
6 years ago
kolaente 225c48982b Fixed heatmap not working in mssql (#5248) 6 years ago
zeripath 7d9a191a3c Create AuthorizedKeysCommand (#5236) 6 years ago
zeripath 00533d3870 Keys API changes (#4960)
* Add private information to the deploy keys api

This commit adds more information to the deploy keys to allow for back
reference in to the main keys list. It also adds information about the
repository that the key is referring to.

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

* Add private information to the user keys API

This adjusts the keys API to give out private information to user keys if
the current user is the owner or an admin.

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

* Add ability to search keys by fingerprint

This commit adds the functionality to search ssh-keys by fingerprint of
the ssh-key. Deploy keys per repository can also be searched. There is
no current clear API point to allow search of all deploy keys by
fingerprint or keyID.

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

* Add integration test
6 years ago
Stanislav 794049e824 fix compatibility heatmap with mysql 8 (#5232) 6 years ago
Jerry Jacobs 22ad514297 Fix issue where ecdsa and other key types are not synced from LDAP (#5092) (#5094)
* Fix issue where ecdsa and other key types are not synced from LDAP authentication provider fixes #5092

* integrations/auth_ldap_test.go: Add Hermes Conrad new ecdsa-sha2-nistp256 publickey fingerprint

* integrations/auth_ldap_test.go: Use ssh-keygen -lf <filename> -E sha256
6 years ago
Lunny Xiao 10370651fc This commit will reduce join star, repo_topic, topic tables on repo search, so that fix extra columns problem on mssql (#5136)
* This commit will reduce join star, repo_topic, topic tables on repo search, so that fix extra columns problem on mssql

* fix tests
6 years ago
Lunny Xiao e61c6cd3db fix data race on migrate repository (#5224) 6 years ago
Lunny Xiao 735b12eaf0
fix sqlite lock (#5210) 6 years ago
Lunny Xiao 70a80e31cf fix sqlite and mssql lock (#5214) 6 years ago
Lunny Xiao 2b7c366f64
fix sqlite lock (#5184)
* fix sqlite lock

* fix bug

Co-Authored-By: lunny <xiaolunwen@gmail.com>

* fix bug

Co-Authored-By: lunny <xiaolunwen@gmail.com>
6 years ago
Lunny Xiao e7822473e9 Fix race on updatesize (#5190)
* fix race on updatesize

* fix more repoPath
6 years ago
Lunny Xiao 5f938c0c78
Fix sqlite lock (#5176)
* fix sqlite lock

* fix sqlite lock on getUnitType
6 years ago
Antoine GIRARD 70ad46133f Fix JSON result of empty array (#5154) 6 years ago
kolaente 6759237eda User action heatmap (#5131)
* Added basic heatmap data

* Added extra case for sqlite

* Built basic heatmap into user profile

* Get contribution data from api & styling

* Fixed lint & added extra group by statements for all database types

* generated swagger spec

* generated swagger spec

* generated swagger spec

* fixed swagger spec

* fmt

* Added tests

* Added setting to enable/disable user heatmap

* Added locale for loading text

* Removed UseTiDB

* Updated librejs & moment.js

* Fixed import order

* Fixed heatmap in postgresql

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

Co-Authored-By: kolaente <konrad@kola-entertainments.de>

* Added copyright header

* Fixed a bug to show the heatmap for the actual user instead of the currently logged in

* Added integration test for heatmaps

* Added a heatmap on the dashboard

* Fixed timestamp parsing

* Hide heatmap on mobile

* optimized postgresql group by query

* Improved sqlite group by statement
6 years ago
Mura Li 9458880c06 Increase the retry limit to 20 times and the interval to 200ms (#5134)
The original settings has less tolerance and would fail on some
environments.
6 years ago
Filip Navara 9b2fcadeef Fix SQL quoting (#5117)
`show` is keyword in MySQL and has to be quoted to reference a column name. Use grave accents (ASCII code 96) for quoting to match rest of the source code. It's non-standard SQL, but it's supported by SQLite and MySQL.

Signed-off-by: Filip Navara <navara@emclient.com>
6 years ago
Oleg Kovalov 5a4648cdd6 Remove check for negative length (#5120) 6 years ago
Mura Li 583b1b8429 Retry test-fixtures loading in case of transaction rollback (#5125) 6 years ago
Oleg Kovalov cabdf84f1f Use named const instead of a raw string (#5115) 6 years ago
Oleg Kovalov a908b29a74 Remove duplicated if bodies (#5121) 6 years ago
Lunny Xiao 616b8f42f9 Fix deadlock when sqlite (#5118)
* fix deadlock when sqlite

* fix clonelink deadlock on sqlite
6 years ago
Oleg Kovalov fef0410b92 Make switch more clear (#5119) 6 years ago
Lunny Xiao ea619b39b2
Add notification interface and refactor UI notifications (#5085)
* add notification interface and refactor UI notifications

* add missing methods on notification interface and notifiy only issue status really changed

* implement NotifyPullRequestReview for ui notification
6 years ago
zeripath dd62ca7ba9 Add support for search by uid (#4876)
Signed-off-by: Andrew Thornton <art27@cantab.net>
6 years ago
Bo-Yi Wu 1e34413238 refactor: err != nil check, just return error instead (#5093) 6 years ago
Bo-Yi Wu 486e989a39 feat(topic): search keyword by splitting provided values by , (#4939) 6 years ago
kolaente e79e9248fd Fix regex to support optional end line of old section in diff hunk (#5096)
+ Named groups in reges for easier group parsing
6 years ago