2255 Commits (356854fc5f8d7d1a7e4d68c9e00929e9ce8aa867)

Author SHA1 Message Date
zeripath 356854fc5f Move serv hook functionality & drop GitLogger (#6993)
* Move hook functionality internally

* Internalise serv logic

* Remove old internal paths

* finally remove the gitlogger

* Disallow push on archived repositories

* fix lint error

* Update modules/private/key.go

* Update routers/private/hook.go

* Update routers/private/hook.go

* Update routers/private/hook.go

* Updated routers/private/serv.go

* Fix LFS Locks over SSH

* rev-list needs to be run by the hook process

* fixup

* Improve git test

* Ensure that the lfs files are created with a different prefix

* Reduce the replication in git_test.go

* slight refactor

* Remove unnecessary "/"

* Restore ensureAnonymousClone

* Restore ensureAnonymousClone

* Run rev-list on server side

* Try passing in the alternative directories instead

* Mark test as skipped

* Improve git test

* Ensure that the lfs files are created with a different prefix
* Reduce the replication in git_test.go
* Remove unnecessary "/"
5 years ago
Richard Mahn 1831b3b571 Fixes #5960 - Adds API Endpoint for Repo Edit (#7006)
* Feature - #5960 - API Endpoint for Repo Editing

* Revert from merge

* Adds integration testing

* Updates to integration tests

* Revert changes

* Update year in file header

* Misspell fix

* XORM = test

* XORM = test

* revert XORM = file

* Makes RepoUnit.ID be pk and autoincr

* Fix to units

* revert header

* Remove print statement

* Adds other responses

* Improves swagger for creating repo

* Fixes import order

* Better Unit Type does not exist error

* Adds editable repo properties to the response repo structure

* Fix to api_repo_edit_test.go

* Fixes repo test

* Changes per review

* Fixes typo and standardizes comments in the EditRepoOption struct for swagger

* Fixes typo and standardizes comments in the EditRepoOption struct for swagger

* Actually can unarchive through the API

* Unlike delete, user doesn't have to be the owner of the org, just admin to the repo

* Fix to swagger comments for field name change

* Update to swagger docs

* Update swagger

* Changes allow_pull_requests to has_pull_requests
5 years ago
Sergey Dryabzhinsky 3fd18838aa Repository avatars (#6986)
* Repository avatars

- first variant of code from old work for gogs
- add migration 87
- add new option in app.ini
- add en-US locale string
- add new class in repository.less

* Add changed index.css, remove unused template name

* Update en-us doc about configuration options

* Add comments to new functions, add new option to docker app.ini

* Add comment for lint

* Remove variable, not needed

* Fix formatting

* Update swagger api template

* Check if avatar exists

* Fix avatar link/path checks

* Typo

* TEXT column can't have a default value

* Fixes:

- remove old avatar file on upload
- use ID in name of avatar file - users may upload same files
- add simple tests

* Fix fmt check

* Generate PNG instead of "static" GIF

* More informative comment

* Fix error message

* Update avatar upload checks:

- add file size check
- add new option
- update config docs
- add new string to en-us locale

* Fixes:

- use FileHEader field for check file size
- add new test - upload big image

* Fix formatting

* Update comments

* Update log message

* Removed wrong style - not needed

* Use Sync2 to migrate

* Update repos list view

- bigger avatar
- fix html blocks alignment

* A little adjust avatar size

* Use small icons for explore/repo list

* Use new cool avatar preparation func by @lafriks

* Missing changes for new function

* Remove unused import, move imports

* Missed new option definition in app.ini

Add file size check in user/profile avatar upload

* Use smaller field length for Avatar

* Use session to update repo DB data, update DeleteAvatar - use session too

* Fix err variable definition

* As suggested @lafriks - return as soon as possible, code readability
5 years ago
zeripath 57b2ce03d5
Handle early git version's lack of get-url (#7065) 5 years ago
Bo-Yi Wu 743697a549
refactor: append, build variable and type switch (#4940)
* refactor: append, build variable and type switch

* fix: remove redundant space.
5 years ago
Bo-Yi Wu 66863ab770 chore: change issue mail title. (#7064)
* chore: change issue mail title.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* change to fullname method

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
5 years ago
Lunny Xiao c2f3938a58 fix possbile mysql invalid connnection error (#7051) 5 years ago
Rob Watson df2557835b Improve handling of non-square avatars (#7025)
* Crop avatar before resizing (#1268)

Signed-off-by: Rob Watson <rfwatson@users.noreply.github.com>

* Fix spelling error

Signed-off-by: Rob Watson <rfwatson@users.noreply.github.com>
5 years ago
jpicht 8cd4c2242c Fix default for allowing new organization creation for new users (#7017)
Fixed #6542

When creating users DefaultAllowCreateOrganization was ignored.

Signed-off-by: Julian Picht <julian.picht@gmail.com>

* fix TestCreateUser_Issue5882

Signed-off-by: Julian Picht <julian.picht@gmail.com>
5 years ago
Lunny Xiao d5a98a2969 Add support of utf8mb4 for mysql (#6992) 5 years ago
zeripath 54bd63cd5c
Change UpdateRepoIndex api to include watchers (#7012)
* Change UpdateRepoIndex api to include watchers

* Add timeout
5 years ago
Lunny Xiao 1f84970de0
Make webhook http connections resuable (#6976)
* make http connections resuable

* add error handler

* fix lint
5 years ago
David Schneiderbauer 8de76b6e64 fix u2f registrationlist ToRegistrations() method (#6980) 5 years ago
Lunny Xiao c385dcc26b
Fix index produces problem when issues/pulls deleted (#6973)
* fix index produces problem when issues/pulls deleted

* fix tests

* fix tests

* fix tests
5 years ago
zeripath 96b412bb87 Stop running hooks on pr merge (#6963)
* Stop running hooks on pr merge

* Remove SSH_ORIGINAL_COMMAND from the pushing environment
5 years ago
mrsdizzie 68a83cc5a2 Allow collaborators to view repo owned private org (#6965)
Handle case where an orginization is private but a user who is not a
member of the orgninization has been added as a collaborator of a repo
within that org

Fixes #6962
5 years ago
zeripath 56ae539bed SearchRepositoryByName improvements and unification (#6897) 5 years ago
techknowlogick 5fb1ad7011 Webhook Logs show proper HTTP Method, and allow change HTTP method in form (#6953)
* Fix #6951 - logs show proper HTTP Method, and allow change HTTP method
in form

* enforce POST method for webhook

* set default if method is empty
5 years ago
Lunny Xiao 710245e81e
Refactor models.NewRepoContext to extract git related codes to modules/git (#6941)
* refactor models.NewRepoContext to extract git related codes to modules/git

* fix imports

* refactor
5 years ago
zeripath e55c874dd2 Add work path CLI option (#6922)
Makes it possible to set the work path as a CLI option instead of
relying on environment variables which are somewhat opaque
5 years ago
Lunny Xiao 24a536d145 Remove macaron dependent on models (#6940) 5 years ago
Lunny Xiao 8b36f01f45 Move xorm logger bridge from log to models so that log module could be a standalone package (#6944)
* move xorm logger bridge from log to models so that log module could be a standalone package

* fix tests

* save logger on xorm log bridge
5 years ago
Lunny Xiao e63274ee09 remove macaron dependent on models/mail.go (#6931) 5 years ago
Mura Li 0b785481d7 Use modules/git for git commands (#6775) 5 years ago
zeripath ce8de35334 Remove local clones & make hooks run on merge/edit/upload (#6672)
* Add options to git.Clone to make it more capable

* Begin the process of removing the local copy and tidy up

* Remove Wiki LocalCopy Checkouts

* Remove the last LocalRepo helpers

* Remove WithTemporaryFile

* Enable push-hooks for these routes

* Ensure tests cope with hooks

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

* Remove Repository.LocalCopyPath()

* Move temporary repo to use the standard temporary path

* Fix the tests

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

* Remove LocalWikiPath

* Fix missing remove

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

* Use AppURL for Oauth user link (#6894)

* Use AppURL for Oauth user link

Fix #6843

* Update oauth.go

* Update oauth.go

* internal/ssh: ignore env command totally (#6825)

* ssh: ignore env command totally

* Remove commented code 

Needed fix described in issue #6889

* Escape the commit message on issues update and title in telegram hook (#6901)

* update sdk to latest (#6903)

* improve description of branch protection (fix #6886) (#6906)

The branch protection description text were not quite accurate.

* Fix logging documentation (#6904)

* ENABLE_MACARON_REDIRECT should be REDIRECT_MACARON_LOG

* Allow DISABLE_ROUTER_LOG to be set in the [log] section

* [skip ci] Updated translations via Crowdin

* Move sdk structs to modules/structs (#6905)

* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
5 years ago
Lunny Xiao 34eee25bd4
Move sdk structs to modules/structs (#6905)
* move sdk structs to moduels/structs

* fix tests

* fix fmt

* fix swagger

* fix vendor
5 years ago
zeripath d64a646c0a Escape the commit message on issues update and title in telegram hook (#6901) 5 years ago
Wim 4508380cf7 Show full name if DefaultShowFullName setting activated (#6710)
Adds a new key DEFAULT_SHOW_FULL_NAME (default false) to the [ui] section.
If enabled the full name will be shown (unless it's empty, then
the default username will be used)
5 years ago
Lunny Xiao 9f18b23129 Fix 404 when send pull request some situation (#6871) 5 years ago
Lunny Xiao 08069dc465
Improve migrations to support migrating milestones/labels/issues/comments/pullrequests (#6290)
* add migrations

* fix package dependency

* fix lints

* implements migrations except pull requests

* add releases

* migrating releases

* fix bug

* fix lint

* fix migrate releases

* fix tests

* add rollback

* pull request migtations

* fix import

* fix go module vendor

* add tests for upload to gitea

* more migrate options

* fix swagger-check

* fix misspell

* add options on migration UI

* fix log error

* improve UI options on migrating

* add support for username password when migrating from github

* fix tests

* remove comments and fix migrate limitation

* improve error handles

* migrate API will also support migrate milestones/labels/issues/pulls/releases

* fix tests and remove unused codes

* add DownloaderFactory and docs about how to create a new Downloader

* fix misspell

* fix migration docs

* Add hints about migrate options on migration page

* fix tests
5 years ago
Lunny Xiao 2382f1b057
fix 500 when reviewer is deleted with integration tests (#6856) 5 years ago
zeripath 0081cd8dfe Add mssql migration tests (#6852) 5 years ago
zeripath d1a32fa108 Attempt to fix #6707 (#6823) 5 years ago
Simon a2a006a5d5 Add GET requests to webhook (#6771)
* Add GET requests to webhook

* make fmt

* Handle invalid http method on webhook

* Uppercase http method in webhook

* Rename v85.go to v86.go

* make fmt
5 years ago
zeripath 07bcccf9ce
Fix v85.go: Set UNIQUE constraint later (#6851)
Signed-off-by: Andrew Thornton <art27@cantab.net>
5 years ago
techknowlogick 46373e7657
Hash App token (#6724) 5 years ago
Lauris BH 1fa9662946
Git statistics in Activity tab (#4724)
* Initial implementation for git statistics in Activity tab

* Create top user by commit count endpoint

* Add UI and update src-d/go-git dependency

* Add coloring

* Fix typo

* Move git activity stats data extraction to git module

* Fix message

* Add git code stats test
5 years ago
SagePtr 59f879bfec Fix double-generation of scratch token (#6832) (#6833) 5 years ago
zeripath 159294f799 When mirroring we should set the remote to mirror (#6824) 5 years ago
mrsdizzie caba2829ef Improve issue reference on commit (#6694)
* Improve issue reference on commit

Allow commits to properly reference issues in other repositories and also to
close/reopen those issues if user has code permission. Should match
Github behavior described here: https://help.github.com/en/articles/closing-issues-using-keywords

Fixes 6664

* Fix missing return

* Match user/repo directly in regex
5 years ago
zeripath 8d0d7bc28d Make CustomPath, CustomConf and AppWorkPath configurable at build (#6631) 5 years ago
Lukas Prettenthaler 81059a2567 LDAP: ignore already existing public keys after ldap sync (#6766)
* fix type in public key exist error, only log trace for ldap public key import if existing

Signed-off-by: Lukas Prettenthaler <lukas@noenv.com>

* cleanup switch statement

Signed-off-by: Lukas Prettenthaler <lukas@noenv.com>

* replace switch with if, fix log formatting

Signed-off-by: Lukas Prettenthaler <lukas@noenv.com>

* fix formatting

Signed-off-by: Lukas Prettenthaler <lukas@noenv.com>
5 years ago
Lunny Xiao 4c34bc111c
fix pulls broken when fork repository deleted (#6754)
* fix pulls broken when fork repository deleted

* fix lint
5 years ago
Lunny Xiao 199faadea3 Fix org visibility bug when git cloning (#6743)
* fix org visibility bug

* fix permission check

* add integration tests

* fix tests

* change test user name for easier maintainance and fix test

* fix test git repo name
5 years ago
Lunny Xiao 65b3f513c3
fix new team 500 (#6749)
* fix new team 500

* Update models/unit.go

Co-Authored-By: lunny <xiaolunwen@gmail.com>
5 years ago
Lunny Xiao ff03b2f606 Fix: Sort repos on org home page with non-admin login (#6741) 5 years ago
Lanre Adelowo 821184c203 Drop is_bare IDX only when it exists for MySQL and MariaDB (#6736)
* Drop is_bare IDX only when it exists

* show indexes only on mysql or mariadb
5 years ago
techknowlogick cbf8538635
Disable web preview for telegram webhook (#6719) 5 years ago
zeripath be666b03ee Trace Logging on Permission Denied & ColorFormat (#6618)
* Add log.ColorFormat and log.ColorFormatted

Structs can now implement log.ColorFormatted to provide their own
colored format when logged with `%-v` or additional flags.

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

* Add basic ColorFormat to repository and user

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

* Add basic ColorFormat to access and unit

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

* Add ColorFormat to permission and on trace log it

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

* Add log.NewColoredIDValue to make ID value coloring consistent

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

* formatting changes

* Add some better tracing to permission denied for read issues/pulls

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

* Add Trace logging on permission denied

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

* Remove isTrace() check from deferred func

* Adjust repo and allow logging of team

* use FormatInt instead of Itoa

* Add blank line

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

* Update access.go
5 years ago
Andrzej Ressel 469d9b7d9a Add option to blame files (#5721) 5 years ago