2405 Commits (1b72690cb82302b24f41d2beaa5df5592709f4d3)

Author SHA1 Message Date
Lunny Xiao 8edf3d5804 Move sync mirror actions to mirror service package (#8518)
* move sync mirror actions to mirror service

* fix go.mod

* fix lint

* fix lint
5 years ago
Lunny Xiao 1d9a1a0d45 Fix migrate mirror 500 bug (#8526) 5 years ago
zeripath 167e8f18da
Restore Graceful Restarting & Socket Activation (#7274)
* Prevent deadlock in indexer initialisation during graceful restart

* Move from gracehttp to our own service to add graceful ssh

* Add timeout for start of indexers and make hammer time configurable

* Fix issue with re-initialization in indexer during tests

* move the code to detect use of closed to graceful

* Handle logs gracefully - add a pid suffix just before restart

* Move to using a cond and a holder for indexers

* use time.Since

* Add some comments and attribution

* update modules.txt

* Use zero to disable timeout

* Move RestartProcess to its own file

* Add cleanup routine
5 years ago
blueworrybear 8c909820a9 Enable Uploading/Removing Attachments When Editing an Issue/Comment (#8426) 5 years ago
Lunny Xiao 20477a69ea
Move clearlabels from models to issue service (#8326)
* move clearlabels from models to issue service

* improve code

* Apply suggestions from code review

Co-Authored-By: zeripath <art27@cantab.net>
5 years ago
Lunny Xiao 34fb9d68a5 Move AddTestPullRequestTask to pull service package from models (#8324)
* move AddTestPullRequestTask to pull service package from models

* fix fmt
5 years ago
David Svantesson 8ad2697611 Recalculate repository access only for specific user (#8481)
* Recalculate repository access only for specific user

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Handle user repositories as well, and only add access if minimum mode

* Need to get repo owner to check if organization
5 years ago
jaqra 086bfb8b4b Add pagination to commit graph page (#8360)
Fixes #8308
5 years ago
Lunny Xiao f9aba9ba0f fix bug on FindExternalUsersByProvider (#8504) 5 years ago
Lunny Xiao e3e44a59d0 Update migrated repositories' issues/comments/prs poster id if user has a github external user saved (#7751)
* update migrated issues/comments when login as github

* add get userid when migrating or login with github oauth2

* fix lint

* add migrations for repository service type

* fix build

* remove unnecessary dependencies on migrations

* add cron task to update migrations poster ids and fix posterid when migrating

* fix lint

* fix lint

* improve code

* fix lint

* improve code

* replace releases publish id to actual author id

* fix import

* fix bug

* fix lint

* fix rawdata definition

* fix some bugs

* fix error message
5 years ago
guillep2k 15809d81f7 Rewrite reference processing code in preparation for opening/closing from comment references (#8261)
* Add a markdown stripper for mentions and xrefs

* Improve comments

* Small code simplification

* Move reference code to modules/references

* Fix typo

* Make MarkdownStripper return [][]byte

* Implement preliminary keywords parsing

* Add FIXME comment

* Fix comment

* make fmt

* Fix permissions check

* Fix text assumptions

* Fix imports

* Fix lint, fmt

* Fix unused import

* Add missing export comment

* Bypass revive on implemented interface

* Move mdstripper into its own package

* Support alphanumeric patterns

* Refactor FindAllMentions

* Move mentions test to references

* Parse mentions from reference package

* Refactor code to implement renderizable references

* Fix typo

* Move patterns and tests to the references package

* Fix nil reference

* Preliminary rendering attempt of closing keywords

* Normalize names, comments, general tidy-up

* Add CSS style for action keywords

* Fix permission for admin and owner

* Fix golangci-lint

* Fix golangci-lint
5 years ago
zeripath 300d9a1c70 Fixes #8369: Create .ssh dir as necessary (#8486)
* Ensure .ssh dir exists before rewriting public keys

* Ensure .ssh dir exists before appending to authorized_keys

* Log the error because it would be useful to know where it is trying to MkdirAll

* Only try to create RootPath if it's not empty
5 years ago
Lunny Xiao f2a3abc683
Move migrating repository from frontend to backend (#6200)
* move migrating to backend

* add loading image when migrating and fix tests

* fix format

* fix lint

* add redis task queue support and improve docs

* add redis vendor

* fix vet

* add database migrations and fix app.ini sample

* add comments for task section on app.ini.sample

* Update models/migrations/v84.go

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

* Update models/repo.go

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

* move migrating to backend

* add loading image when migrating and fix tests

* fix fmt

* add redis task queue support and improve docs

* fix fixtures

* fix fixtures

* fix duplicate function on index.js

* fix tests

* rename repository statuses

* check if repository is being create when SSH request

* fix lint

* fix template

* some improvements

* fix template

* unified migrate options

* fix lint

* fix loading page

* refactor

* When gitea restart, don't restart the running tasks because we may have servel gitea instances, that may break the migration

* fix js

* Update models/repo.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

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

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* fix tests

* rename ErrTaskIsNotExist to ErrTaskDoesNotExist

* delete release after add one on tests to make it run happy

* fix tests

* fix tests

* improve codes

* fix lint

* fix lint

* fix migrations
5 years ago
guillep2k f1fdd782d5 Add check for empty set when dropping indexes during migration (#8471)
* Add check for empty set when dropping indexes during migration
5 years ago
zeripath 5e759b60cc Restore functionality for early gits (#7775)
* Change tests to make it possible to run TestGit with 1.7.2

* Make merge run on 1.7.2

* Fix tracking and staging branch name problem

* Ensure that git 1.7.2 works on tests

* ensure that there is no chance for conflicts

* Fix-up missing merge issues

* Final rm

* Ensure LFS filters run on the tests

* Do not sign commits from temp repo

* Restore tracking fetch change

* Apply suggestions from code review

* Update modules/repofiles/temp_repo.go
5 years ago
Lunny Xiao 46a12f196b
Move change issue title from models to issue service package (#8456)
* move change issue title from models to issue service package

* make the change less

* fix typo
5 years ago
zeripath 9ff9f5ad1d Ensure that LFS files are relative to the LFS content path (#8455) 5 years ago
guillep2k df2c11a878 Ignore mentions for users with no access (#8395)
* Draft for ResolveMentionsByVisibility()

* Correct typo

* Resolve teams instead of orgs for mentions

* Create test for ResolveMentionsByVisibility

* Fix check for individual users and doer

* Test and fix team mentions

* Run all mentions through visibility filter

* Fix error check

* Simplify code, fix doer included in teams

* Simplify team id list build
5 years ago
guillep2k dd611c9a86 Fix migration v96 to keep issue attachments (#8435)
* Fix migration v96 to keep issue attachments

* Fix == operator
5 years ago
guillep2k 4843723d00 Allow users with explicit read access to give approvals (#8382) 5 years ago
Lunny Xiao 170743c8a0 Revert "Fix issues/pr list broken when there are many repositories (#8409)" (#8427)
This reverts commit 78438d310b.
5 years ago
Lunny Xiao 78438d310b
Fix issues/pr list broken when there are many repositories (#8409)
* fix issues/pr list broken when there are many repositories

* remove unused codes

* fix counting error on issues/prs

* keep the old logic

* fix panic

* fix tests
5 years ago
Lunny Xiao 662a40ea29 Update milestone issues numbers when save milestone and other code improvements (#8411)
* update milestone issues numbers when save milestone and other code improvements

* fix tests

* extract duplicate codes as a new function
5 years ago
Lunny Xiao 51fade4c44 Fix milestone num_issues (#8221)
* fix milestone num_issues

* update missing completeness

* only update milestone closed number when closed issue is assigned a new milestone or clear milestone

* fix tests

* fix update milestone num

* fix completeness calculate

* make completeness calucation more clear
5 years ago
Lunny Xiao bd41a04a56 Add extra user information when migrating release (#8331)
* add extra user information when migrating release

* add migrations

* fix tests
5 years ago
guillep2k 740a0c4dd4 Fix column name ambiguity in GetUserIssueStats() (#8347)
* Add test for FilterModeMention

* Fix column name ambiguity

* Fix fmt
5 years ago
guillep2k cd13f273d1 Transaction-aware retry create issue to cope with duplicate keys (#8307)
* Revert #7898

* Transaction-aware retry create issue to cope with duplicate keys

* Restore INSERT ... WHERE usage

* Rearrange code for clarity

* Fix error return in newIssue()

* Fix error message
5 years ago
David Svantesson 90ab3056eb Api: advanced settings for repository (external wiki, issue tracker etc.) (#7756)
* Add API for Repo Advanced Settings of wiki and issue tracker

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add some integration tests for tracker and wiki settings through API

* Should return StatusUnprocessableEntity in case of invalid API values.

* Add tests for invalid URLs for external tracker and wiki.

* Do not set inital values if they are default of type

* Make issue tracker and wiki units separate structures in Repository API structure.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Fix comment of structures

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Rewrite API to use struct for setting tracker and wiki settings.

* LetOnlyContributorsTrackTime -> AllowOnlyContributorsToTrackTime
5 years ago
Lunny Xiao 7ff783b732
Move mirror to a standalone package from models (#7486)
* move mirror to a standalone package

* fix mirror address in template

* fix tests

* fix lint

* fix comment

* fix tests

* fix tests

* fix vendor

* fix fmt

* fix lint

* remove wrong file submitted

* fix conflict

* remove unrelated changes

* fix go mod

* fix tests

* clean go mod

* make vendor work

* make vendor work

* fix tests

* remove duplicated test
5 years ago
David Svantesson 36bcd4cd6b API endpoint for searching teams. (#8108)
* Api endpoint for searching teams.

Signed-off-by: dasv <david.svantesson@qrtech.se>

* Move API to /orgs/:org/teams/search

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Regenerate swagger

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Fix search is Get

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add test for search team API.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Update routers/api/v1/org/team.go

grammar

Co-Authored-By: Richard Mahn <richmahn@users.noreply.github.com>

* Fix review comments

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Fix some issues in repo collaboration team search, after changes in this PR.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Remove teamUser which is not used and replace with actual user id.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Remove unused search variable UserIsAdmin.

* Add paging to team search.

* Re-genereate swagger

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Fix review comments

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* fix

* Regenerate swagger
5 years ago
Lunny Xiao 3249c0ccba
Extract actions on deletereleasebyid from models to release service (#8219)
* extract actions on deletereleasebyid from models to release service

* fix tests
5 years ago
Lunny Xiao e6113000c5
Extract actions on new issue from models to services (#8217)
* extract actions on new issue from models to services

* improve code

* rename services/issues to services/issue
5 years ago
Elias Norberg 49547ea158 Show correct commit status in PR list (#8316)
* Use correct index when fetching commit status

Signed-off-by: Elias Norberg <elias@aisle.se>

* Compare against base repo to avoid mismatch when merging from fork

Signed-off-by: Elias Norberg <elias@aisle.se>
5 years ago
Lunny Xiao aa9a99cf5f
Upgrade xorm to latest to fix insert issue bug (#8309)
* upgrade xorm to latest to fix insert issue bug

* add newissue unit tests

* update xorm version

* fix tests
5 years ago
Lunny Xiao eb11ca6847
Extract actions on new pull request from models to pulls service and move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull (#8218)
* extract actions on new pull request from models to pulls service

* improve code

* move code.gitea.io/gitea/modules/pull to code.gitea.io/gitea/services/pull

* fix fmt

* Rename pulls.go to pull.go
5 years ago
Sandro Santilli d958b9db4f Alwaywas return local url for users avatar (#8245)
* Always return local url for users avatar

Avoids having to wait for DNS lookups when libravatar is activated
fixing #6046

* Avoid double slash in avatar link

* Move avatar route to the correct place
5 years ago
guillep2k c05b89a5aa Fix nil ref (#8281) 5 years ago
Lunny Xiao 061388379a Move create issue comment to comments package (#8212)
* move create issue comment to comments package

* extract actions on update/delete comment from models to comment service

* fix lint

* fix lint
5 years ago
Sandro Santilli 3dd1cee331 Test more reserved usernames (#8263)
* Test more reserved usernames

* Add more reserved usernames, sort them

* Reserve "attachments" username (is a used route)

* It's "avatars" being reserved, not "avatar"
5 years ago
Lunny Xiao 29dda47cbb
Fix label count (#8267)
* fix label count

* fix vendor

* fix import order

* update xorm to fix bug

* fix tests

* fix mssql bug
5 years ago
Lunny Xiao 5a438ee3c0
Move all mail related codes from models to services/mailer (#7200)
* move all mail related codes from models to modules/mailer

* fix lint

* use DBContext instead Engine

* use WithContext not WithEngine

* Use DBContext instead of Engine

* don't use defer when sess.Close()

* move DBContext to context.go and add some methods

* move mailer from modules/ to services

* fix lint

* fix tests

* fix fmt

* add gitea copyright

* fix tests

* don't expose db functions

* make code clear

* add DefaultDBContext

* fix build

* fix bug
5 years ago
David Svantesson a0e88dfc2e Add teams to repo on collaboration page. (#8045)
* Add teams to repo on collaboration page.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add option for repository admins to change teams access to repo.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add comment for functions

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Make RepoAdminChangeTeamAccess default false in xorm and make it default checked in template instead.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Make proper language strings and fix error redirection.

* Add unit tests for adding and deleting team from repository.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add database migration

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Fix redirect

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Fix locale string mismatch.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Move team access mode text logic to template.

* Move collaborator access mode text logic to template.
5 years ago
Lanre Adelowo 63ff61615e Delete releases attachments if release is deleted (#6068)
* delete attachments from the database and file system

* add migration

* fix import statements

* fix package name

* remove conditional should in case the confi has been changed and the server restarted

* simplify deletion of attachments in DB

* fix CI build

* fix review

* add copyright in the proper place

* fix review
5 years ago
guillep2k 2a2b46c62e Reference issues from pull requests and other issues (#8137)
* Update ref comment

* Generate comment on simple ref

* Make fmt + remove unneeded repo load

* Add TODO comments

* Add ref-check in issue creation; re-arrange template

* Make unit tests pass; rearrange code

* Make fmt

* Filter out xref comment if user can't see the referencing issue

* Add TODOs

* Add cross reference

* Rearrange code; add cross-repository references

* Striketrhough obsolete references

* Remove unnecesary TODO

* Add "not supported" note

* Support for edits and deletes, and issue title

* Revert changes to go.mod

* Fix fmt

* Add support for xref from API

* Add first integration test

* Add integration tests

* Correct formatting

* Fix add comment test

* Add migration

* Remove outdated comments; fix typo

* Some code refactoring and rearranging

* Rename findCrossReferences to createCrossReferences

* Delete xrefs when repository is deleted

* Corrections as suggested by @lafriks

* Prepare for merge

* Fix log for errors
5 years ago
Daniel Fonseca de Lira 09e452f84a Fix release API URL generation (#8234) 5 years ago
jaqra 28362195a0 Add 'Mentioning you' group to /issues page (#8201) 5 years ago
Lunny Xiao 04ca7f0047 Refuse merge until all required status checks success (#7481)
* refuse merge until ci successfully

* deny merge request when required status checkes not succeed on merge Post and API

* add database migration for added columns on protected_branch

* fix migration

* fix protected branch check bug

* fix protected branch settings

* remove duplicated code on check pull request's required commit statuses pass

* remove unused codes

* fix migration

* add newline for template file

* fix go mod

* rename function name and some other fixes

* fix template

* fix bug pull view

* remove go1.12 wrong dependencies

* add administrator bypass when protected branch status check enabled

* fix bug

* improve the codes
5 years ago
Lunny Xiao 29454733b4
move some milestone functions to a standalone package (#8213) 5 years ago
Bjoern Petri 99f3ee3bf3 MS Teams webhook misses commit messages (#8209)
The current webhook just shows the amount of commits, but misses the actual commit description. While the code is actually there to include the description, it is just not included.

Signed-off-by: Bjoern Petri <bjoern.petri@sundevil.de>
5 years ago
Jakob Ackermann 89648746a5 [ssh] fix the config specification in the authorized_keys template (#8031)
The gitea flags must appear in front of the gitea command. Otherwise
 they are ignored.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
5 years ago