Commit Graph
151 Commits
Author SHA1 Message Date
Jakub Arbetandzeripath a757920f4e Fix failing migration v67 (#5849)
Fixes #5848
2019-01-26 14:50:36 +00:00
Lunny XiaoandLauris BH b80d6490f3 fix migration 78 error mssql (#5791) 2019-01-21 12:12:45 +02:00
zeripathandtechknowlogick b0fbefc76b Fix the v78 migration script (#5776)
Unfortunately the last fix didn't completely fix the migration to v79 of the db
due to bug with schema locking during Sync2. This should fix this issue.

Fix #5759

Signed-off-by: Andrew Thornton <[email protected]>
2019-01-19 20:20:52 -05:00
Lunny Xiaoandtechknowlogick 41f19e1a38 fix migration bug (#5762) 2019-01-18 09:50:38 -05:00
zeripathandtechknowlogick 07802a2bc5 Refactor repo.isBare to repo.isEmpty #5629 (#5714)
* Refactor repo.isBare to repo.isEmpty #5629

Signed-off-by: Andrew Thornton <[email protected]>

* Remove Sync call
2019-01-17 19:01:04 -05:00
Lanre Adelowoandtechknowlogick 9e9d1b8f95 Fix migration for user defined themes (#5682) 2019-01-12 14:43:47 -05:00
Lanre Adelowoandtechknowlogick 8d2c24f7f9 Allow for user specific themes (#5668)
* add migration and basic UI for changing a user's theme

* update user themem

* use right text on button

* load theme based on users' selection

* load theme based on users' selection in pwa too

* update sample config

* delete older theme loading

* implement AfterLoad to set users' theme properly

* set up default theme when creating a user. This uses the installation wide theme

* use flash messages for error

* set default theme when creating a user from the cli

* fix @lunny review
2019-01-09 12:22:57 -05:00
Daniel WolfandLunny Xiao b46c279587 update v71.go to resolve #5595 (#5613) 2018-12-31 21:23:03 +08:00
JulianandLauris BH 4a685f8b87 Add rebase with merge commit merge style (#3844) (#4052)
Signed-off-by: Julian Tölle <[email protected]>
2018-12-27 12:27:08 +02:00
Lunny XiaoandGitHub 9d0dee88d2 fix table name typo on SQL (#5562)
* fix table name typo on SQL

* fix reserved word user when on mssql
2018-12-19 20:58:46 +08:00
Lunny Xiaoandtechknowlogick 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
2018-12-18 11:26:26 -05:00
Jonas FranzandLunny Xiao 9681c83734 Approvals at Branch Protection (#5350)
* Add branch protection for approvals

Signed-off-by: Jonas Franz <[email protected]>

* Add required approvals

Signed-off-by: Jonas Franz <[email protected]>

* Add missing comments and fmt

Signed-off-by: Jonas Franz <[email protected]>

* 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 <[email protected]>
2018-12-11 19:28:37 +08:00
Lunny XiaoandLauris BH 4b4453cb92 fix topic name length on database (#5493) 2018-12-08 14:27:30 +02:00
Florian EitelandLauris BH 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
2018-11-18 20:25:32 +02:00
Bo-Yi Wuandtechknowlogick 1e34413238 refactor: err != nil check, just return error instead (#5093) 2018-10-18 00:51:07 -04:00
Lanre AdelowoandLauris BH 126ba796dc Force user to change password (#4489)
* redirect to login page after successfully activating account

* force users to change password if account was created by an admin

* force users to change password if account was created by an admin

* fixed build

* fixed build

* fix pending issues with translation and wrong routes

* make sure path check is safe

* remove unneccessary newline

* make sure users that don't have to view the form get redirected

* move route to use /settings prefix so as to make sure unauthenticated users can't view the page

* update as per @lafriks review

* add necessary comment

* remove unrelated changes

* support redirecting to location the user actually want to go to before being forced to change his/her password

* run make fmt

* added tests

* improve assertions

* add assertion

* fix copyright year

Signed-off-by: Lanre Adelowo <[email protected]>
2018-09-13 15:04:25 +03:00
Lauris BHandJonas Franz 6e64f9db8e Pull request review/approval and comment on code (#3748)
* Initial ui components for pull request review

* Add Review
Add IssueComment types

Signed-off-by: Jonas Franz <[email protected]>

(cherry picked from commit 2b4daab)
Signed-off-by: Jonas Franz <[email protected]>

* Replace ReviewComment with Content

Signed-off-by: Jonas Franz <[email protected]>

* Add load functions
Add ReviewID to findComments

Signed-off-by: Jonas Franz <[email protected]>

* Add create review comment implementation
Add migration for review
Other small changes

Signed-off-by: Jonas Franz <[email protected]>

* Simplified create and find functions for review

Signed-off-by: Jonas Franz <[email protected]>

* Moved "Pending" to first position

Signed-off-by: Jonas Franz <[email protected]>

* Add GetCurrentReview to simplify fetching current review

Signed-off-by: Jonas Franz <[email protected]>

* Preview for listing comments

Signed-off-by: Jonas Franz <[email protected]>

* Move new comment form to its own file

Signed-off-by: Jonas Franz <[email protected]>

* Implement Review form
Show Review comments on comment stream

Signed-off-by: Jonas Franz <[email protected]>

* Add support for single comments
Showing buttons in context

Signed-off-by: Jonas Franz <[email protected]>

* Add pending tag to pending review comments

Signed-off-by: Jonas Franz <[email protected]>

* Add unit tests for Review

Signed-off-by: Jonas Franz <[email protected]>

* Fetch all review ids at once
Add unit tests

Signed-off-by: Jonas Franz <[email protected]>

* gofmt

Signed-off-by: Jonas Franz <[email protected]>

* Improved comment rendering in "Files" view by adding Comments to DiffLine

Signed-off-by: Jonas Franz <[email protected]>

* Add support for invalidating comments

Signed-off-by: Jonas Franz <[email protected]>

* Switched back to code.gitea.io/git

Signed-off-by: Jonas Franz <[email protected]>

* Moved review migration from v64 to v65

Signed-off-by: Jonas Franz <[email protected]>

* Rebuild css

Signed-off-by: Jonas Franz <[email protected]>

* gofmt

Signed-off-by: Jonas Franz <[email protected]>

* Improve translations

Signed-off-by: Jonas Franz <[email protected]>

* Fix unit tests by updating fixtures and updating outdated test

Signed-off-by: Jonas Franz <[email protected]>

* Comments will be shown at the right place now

Signed-off-by: Jonas Franz <[email protected]>

* Add support for deleting CodeComments

Signed-off-by: Jonas Franz <[email protected]>

* Fix problems caused by files in subdirectories

Signed-off-by: Jonas Franz <[email protected]>

* Add support for showing code comments of reviews in conversation

Signed-off-by: Jonas Franz <[email protected]>

* Add support for "Show/Hide outdated"

Signed-off-by: Jonas Franz <[email protected]>

* Update code.gitea.io/git

Signed-off-by: Jonas Franz <[email protected]>

* Add support for new webhooks

Signed-off-by: Jonas Franz <[email protected]>

* Update comparison

Signed-off-by: Jonas Franz <[email protected]>

* Resolve conflicts

Signed-off-by: Jonas Franz <[email protected]>

* Minor UI improvements

* update code.gitea.io/git

* Fix ui bug reported by @lunny causing wrong position of add button
Add functionality to "Cancel" button
Add scale effects to add button
Hide "Cancel" button for existing comments

Signed-off-by: Jonas Franz <[email protected]>

* Prepare solving conflicts

Signed-off-by: Jonas Franz <[email protected]>

* Show add button only if no comments already exist for the line

Signed-off-by: Jonas Franz <[email protected]>

* Add missing vendor files

Signed-off-by: Jonas Franz <[email protected]>

* Check if reviewer is nil

Signed-off-by: Jonas Franz <[email protected]>

* Show forms only to users who are logged in

Signed-off-by: Jonas Franz <[email protected]>

* Revert "Show forms only to users who are logged in"

This reverts commit c083682

Signed-off-by: Jonas Franz <[email protected]>

* Save patch in comment
Render patch for code comments

Signed-off-by: Jonas Franz <[email protected]>

* Add link to comment in code

Signed-off-by: Jonas Franz <[email protected]>

* Add reply form to comment list
Show forms only to signed in users

Signed-off-by: Jonas Franz <[email protected]>

* Add 'Reply' as translatable
Add CODE_COMMENT_LINES setting

Signed-off-by: Jonas Franz <[email protected]>

* gofmt

Signed-off-by: Jonas Franz <[email protected]>

* Fix problems introduced by checking for singed in user

Signed-off-by: Jonas Franz <[email protected]>

* Add v70

Signed-off-by: Jonas Franz <[email protected]>

* Update generated stylesheet

Signed-off-by: Jonas Franz <[email protected]>

* Fix preview
Beginn with new review comment patch system

Signed-off-by: Jonas Franz <[email protected]>

* Add new algo to generate diff for line range
Remove old algo used for cutting big diffs (it was very buggy)

* Add documentation and example for CutDiffAroundLine

* Fix example of CutDiffAroundLine

* Fix some comment UI rendering bugs

* Add code comment edit mode

* Send notifications / actions to users until review gets published
Fix diff generation bug
Fix wrong hashtag

* Fix vet errors

* Send notifications also for single comments

* Fix some notification bugs, fix link

* Fix: add comment icon is only shown on code lines

* Add lint comment

* Add unit tests for git diff

* Add more error messages

* Regenerated css

Signed-off-by: Jonas Franz <[email protected]>

* fmt

Signed-off-by: Jonas Franz <[email protected]>

* Regenerated CSS with latest less version

Signed-off-by: Jonas Franz <[email protected]>

* Fix test by updating comment type to new ID

Signed-off-by: Jonas Franz <[email protected]>

* Introducing CodeComments as type for map[string]map[int64][]*Comment
Other minor code improvements

Signed-off-by: Jonas Franz <[email protected]>

* Fix data-tab issues

Signed-off-by: Jonas Franz <[email protected]>

* Remove unnecessary change

Signed-off-by: Jonas Franz <[email protected]>

* refactored checkForInvalidation

Signed-off-by: Jonas Franz <[email protected]>

* Append comments instead of setting

Signed-off-by: Jonas Franz <[email protected]>

* Use HeadRepo instead of BaseRepo

Signed-off-by: Jonas Franz <[email protected]>

* Update migration

Signed-off-by: Jonas Franz <[email protected]>

* Regenerated CSS

Signed-off-by: Jonas Franz <[email protected]>

* Add copyright

Signed-off-by: Jonas Franz <[email protected]>

* Update index.css

Signed-off-by: Jonas Franz <[email protected]>
2018-08-06 06:43:21 +02:00
techknowlogickandGitHub adf3f004b6 Switch plaintext scratch tokens to use hash instead (#4331) 2018-07-27 08:54:50 -04:00
Lauris BHandtechknowlogick ae9dd239fb Fix migration from older releases (#4495) 2018-07-21 23:15:11 -04:00
kolaenteandtechknowlogick 1bff02de55 Added dependencies for issues (#2196) (#2531) 2018-07-17 17:23:58 -04:00
Lauris BHandtechknowlogick e95417ea2c Fix column droping for MSSQL that need new transaction for that (#4440) 2018-07-13 11:20:40 -04:00
Alexey Terentyevandtechknowlogick 91ff87c0e5 Fixed violation of the unique constraint for v68 migration (#4297) 2018-06-27 01:23:10 -04:00
David Schneiderbauerandtechknowlogick 0b3ea42847 hide issues from org private repos w/o team assignment (#4034) 2018-06-21 12:00:13 -04:00
Alexey TerentyevandLunny Xiao 46d19c4676 Fix topics addition (Another solution) (#4031) (#4258)
* Added topics validation, fixed repo topics duplication (#4031)

Signed-off-by: Alexey Terentyev <[email protected]>

* Added tests

Signed-off-by: Alexey Terentyev <[email protected]>

* Fixed fmt

Signed-off-by: Alexey Terentyev <[email protected]>

* Added comments to exported functions

Signed-off-by: Alexey Terentyev <[email protected]>

* Deleted RemoveDuplicateTopics function

Signed-off-by: Alexey Terentyev <[email protected]>

* Fixed messages

Signed-off-by: Alexey Terentyev <[email protected]>

* Added migration

Signed-off-by: Alexey Terentyev <[email protected]>

* fmt migration file

Signed-off-by: Alexey Terentyev <[email protected]>

* fixed lint

Signed-off-by: Alexey Terentyev <[email protected]>

* Added Copyright

Signed-off-by: Alexey Terentyev <[email protected]>

* Added query solution for duplicates

Signed-off-by: Alexey Terentyev <[email protected]>

* Fixed migration query

Signed-off-by: Alexey Terentyev <[email protected]>

* Changed RegExp. Fixed migration

Signed-off-by: Alexey Terentyev <[email protected]>

* fmt migration file

Signed-off-by: Alexey Terentyev <[email protected]>

* Fixed test for changed regexp

Signed-off-by: Alexey Terentyev <[email protected]>

* Removed validation log messages

Signed-off-by: Alexey Terentyev <[email protected]>

* Renamed migration file

Signed-off-by: Alexey Terentyev <[email protected]>

* Renamed validate function

Signed-off-by: Alexey Terentyev <[email protected]>
2018-06-21 17:09:46 +08:00
David Schneiderbauerandtechknowlogick a93f13849c Fix not removed watches on unallowed repositories (#4201) 2018-06-19 15:44:33 -04:00
Magnus LindvallandLauris BH cdb9478774 LDAP Public SSH Keys synchronization (#1844)
* Add LDAP Key Synchronization feature

Signed-off-by: Magnus Lindvall <[email protected]>

* Add migration: add login source id column for public_key table

* Only update keys if needed

* Add function to only list pubkey synchronized from ldap

* Only list pub ssh keys synchronized from ldap. Do not sort strings as ExistsInSlice does it.

* Only get keys belonging to current login source id

* Set default login source id to 0

* Some minor cleanup. Add integration tests (updete dep testify)
2018-05-24 07:59:02 +03:00
Jonas FranzandLauris BH 951309f76a Add support for FIDO U2F (#3971)
* Add support for U2F

Signed-off-by: Jonas Franz <[email protected]>

* Add vendor library
Add missing translations

Signed-off-by: Jonas Franz <[email protected]>

* Minor improvements

Signed-off-by: Jonas Franz <[email protected]>

* Add U2F support for Firefox, Chrome (Android) by introducing a custom JS library
Add U2F error handling

Signed-off-by: Jonas Franz <[email protected]>

* Add U2F login page to OAuth

Signed-off-by: Jonas Franz <[email protected]>

* Move U2F user settings to a separate file

Signed-off-by: Jonas Franz <[email protected]>

* Add unit tests for u2f model
Renamed u2f table name

Signed-off-by: Jonas Franz <[email protected]>

* Fix problems caused by refactoring

Signed-off-by: Jonas Franz <[email protected]>

* Add U2F documentation

Signed-off-by: Jonas Franz <[email protected]>

* Remove not needed console.log-s

Signed-off-by: Jonas Franz <[email protected]>

* Add default values to app.ini.sample
Add FIDO U2F to comparison

Signed-off-by: Jonas Franz <[email protected]>
2018-05-19 17:12:37 +03:00
Lauris BHandLunny Xiao 382e7276b8 Fix multiple asssingee table migration (#3931) 2018-05-10 09:18:01 +08:00
kolaenteandLauris BH 95f2e2b57b Multiple assignees (#3705) 2018-05-09 19:29:04 +03:00
kolaenteandLunny Xiao 1fdf560678 Added user language setting (#3875)
* Added user language setting

* Added translation string for setting

* Fixed import order + typo

* improved checking if the user has a language saved in the db

* The current saved language is now set a default inside the dropdown

* fmt

* When a user signs in and doesn't have a language saved, the current browser language is saved

* updated gitea-sdk

* Merge branch 'master' of https://github.com/go-gitea/gitea into save-user-language

# Conflicts:
#	models/migrations/migrations.go
#	models/migrations/v62.go

* Made tests work again

* trigger CI

* trigger CI

* fmt

* re-trigger that FUCKING CI SO IT REALLY PICKS UP THE LATEST COMMIT ISTEAD OF PREDENDING TO DO SO

* re-trigger that FUCKING CI SO IT REALLY PICKS UP THE LATEST COMMIT ISTEAD OF PREDENDING TO DO SO

* When loggin in, only the language col gets updated instead of everything
2018-05-05 08:28:30 +08:00
Lauris BHandGitHub 1e1ece8f3d Do not allow to reuse TOTP passcode (#3878) 2018-05-02 18:02:02 +03:00
Jonas FranzandBo-Yi Wu 3e06490d38 Add Size column to attachment (#3734)
* Add size column to attachment
Migrate attachments by calculating file sizes

Signed-off-by: Jonas Franz <[email protected]>

* Calculate attachment size on creation

Signed-off-by: Jonas Franz <[email protected]>

* Log error instead of returning error

Signed-off-by: Jonas Franz <[email protected]>
2018-03-31 09:10:44 +08:00
Allen WildandLunny Xiao 15c6bb500b Add repository setting to enable/disable health checks (#3607)
New Feature:
  * Repository struct field for IsFsckEnabled (default true of course)
  * Admin Settings section on repo options page, accessible only by
    admin users

Possible Enhancements:
  * There's no way to force running health checks on all repos
    regardless of their IsFsckEnabled setting. This would be useful if
    there were an admin API or dashboard button to run fsck immediately.

Issue: https://github.com/go-gitea/gitea/issues/1712
Signed-off-by: Allen Wild <[email protected]>
2018-03-27 22:13:20 +08:00
Chri-sandLauris BH 9350ba7947 Add protected branch whitelists for merging (#3689)
* Add database migrations for merge whitelist

* Add merge whitelist settings for protected branches

* Add checks for merge whitelists
2018-03-25 13:01:32 +03:00
Lauris BHandLunny Xiao c0d41b1b77 Add label descriptions (#3662)
* Add label descriptions

* Add default descriptions to label template
2018-03-13 10:03:55 +08:00
Lauris BHandBo-Yi Wu de8a091767 Fix MySQL and PostgreSQL column drop SQL (#3649) 2018-03-09 09:20:57 +08:00
Lauris BHandBo-Yi Wu dc4afef07f Fix column removal in MSSQL (#3638)
* Fix column removal in MSSQL

* Use xorm session in MSSQL drop column operations

* Add transaction as MSSQL alter table is transactional
2018-03-07 14:44:12 +08:00
Lauris BHandBo-Yi Wu 58893384e8 Add issue closed time column to fix activity closed issues list (#3537)
Signed-off-by: Lauris Bukšis-Haberkorns <[email protected]>
2018-02-19 10:39:26 +08:00
Codruț Constantin GușoiandLauris BH 96c268c0fc Implements generator cli for secrets (#3531)
Signed-off-by: Codruț Constantin Gușoi <[email protected]>
2018-02-18 20:14:37 +02:00
Ethan KoenigandLauris BH f48680888c Remove IsOwner, NumTeams from OrgUser (#3269) 2018-01-08 09:48:37 +02:00
Vlad TemianandLauris BH e78786ef39 Writable deploy keys (closes #671) (#3225)
* Add is_writable checkbox to deploy keys interface

* Add writable key option to deploy key form

* Add support for writable ssh keys in the interface

* Rename IsWritable to ReadOnly

* Test: create read-only and read-write deploy keys via api

* Add DeployKey access mode migration

* Update gitea sdk via govendor

* Fix deploykey migration

* Add unittests for writable deploy keys

* Move template text to locale

* Remove implicit column update

* Remove duplicate locales

* Replace ReadOnly field with IsReadOnly method

* Fix deploy_keys related integration test

* Rename v54 migration with v55

* Fix migration hell
2018-01-07 00:55:53 +02:00
Lauris BHandGitHub 8ac1501ad7 Add Pull Request merge options - Ignore white-space for conflict checking, Rebase, Squash merge (#3188)
* Pull request options migration and UI in settings

* Add ignore whitespace functionality

* Fix settings if pull requests are disabled

* Fix migration transaction

* Merge with Rebase functionality

* UI changes and related functionality for pull request merging button

* Implement squash functionality

* Fix rebase merging

* Fix pull request merge tests

* Add squash and rebase tests

* Fix API method to reuse default message functions

* Some refactoring and small fixes

* Remove more hardcoded values from tests

* Remove unneeded check from API method

* Fix variable name and comment typo

* Fix reset commit count after PR merge
2018-01-05 20:56:50 +02:00
Sandro SantilliandLauris BH 8cd987af0c Add repo-sync-releases admin command (#3254)
* Add repo-sync-releases admin command

Will help recovering corrupted database, see #3247

* Load repos in chunks of 10, exit with error if unable to get a list, scan private repos, fix typo

* Fix debug output about num releases

* Introduce RepositoryListDefaultPageSize constant, set to 64

Use it from the new admin command

* Use RepositoryListDefaultPageSize in more places

* Document RepositoryListDefaultPageSize
2017-12-31 16:45:46 +02:00
Lauris BHandGitHub c06cc740de Reorder migrations, skip errors if running migration again (#3160)
* Reorder migrations, skip errors if running migration again

* Rename migration file names to match migration version

* Add note about ingored error
2017-12-13 16:52:18 +02:00
Lauris BHandGitHub 5dc37b187c Add reactions to issues/PR and comments (#2856) 2017-12-04 01:14:26 +02:00
Antoine GIRARDandLauris BH 4035ab05fa Fix git lfs path (#3016)
* add suffix .git

* Remove Content-Type on GET methods

* Add migrations to force creation before any further potential migration
2017-11-29 01:35:23 +02:00
Ethan KoenigandLauris BH 5866eb2321 Code/repo search (#2582)
Indexed search of repository contents (for default branch only)
2017-10-27 09:10:54 +03:00
BwkoandLunny Xiao 3ab580c8d6 Add branch overiew page (#2108)
* Add branch overiew page

* fix changed method name on sub menu

* remove unused code
2017-10-26 08:49:16 +08:00
Lunny XiaoandGitHub 985a39590b Use buffersize to reduce database connection when iterate (#2724)
* use buffersize to reduce database connection when iterate

* fix typo

* add default value on app.ini comment
2017-10-21 14:26:23 +08:00
Lauris BHandGitHub 8863e74f2a Fix organization watch migration (#2703) 2017-10-14 20:47:05 +03:00