Commit Graph

1988 Commits

Author SHA1 Message Date
Clar Charr c71ee33057 Increase default TOTP secret size to 320 bits (#4287) 2018-07-03 18:10:35 -04:00
Jonas Franz 801843b011 Fix open redirect vulnerability on login screen (#4312)
* Fix open redirect vulnerability on login screen

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

* Reorder imports

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

* Replace www. from Domain too

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2018-06-26 22:45:18 +08:00
David Schneiderbauer 0b3ea42847 hide issues from org private repos w/o team assignment (#4034) 2018-06-21 12:00:13 -04:00
Alexey Terentyev 46d19c4676 Fix topics addition (Another solution) (#4031) (#4258)
* Added topics validation, fixed repo topics duplication (#4031)

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Added tests

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Fixed fmt

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Added comments to exported functions

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Deleted RemoveDuplicateTopics function

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Fixed messages

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Added migration

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* fmt migration file

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* fixed lint

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Added Copyright

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Added query solution for duplicates

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Fixed migration query

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Changed RegExp. Fixed migration

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* fmt migration file

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Fixed test for changed regexp

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Removed validation log messages

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Renamed migration file

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Renamed validate function

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
2018-06-21 17:09:46 +08:00
Russell Aunger 9ae7664df7 Fix webhook type conflation. (#4285)
- Fix typo that caused Gogs hooks to be created as Gitea hooks.
- Fix typo that caused Gogs hooks to be duplicated upon edit (though this bug was masked by the previous one).

Signed-off-by: Russell Aunger <rba@live.com>
2018-06-21 07:22:03 +02:00
Jonas Franz 467ff4d343 Fix milestone appliance and permission checks (#4271)
* Fix milestone appliance
Fix missing permission check

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

* Fix comment

* Add Gitea copyright line
2018-06-19 23:15:11 +08:00
David Schneiderbauer 69bfd81b1c fix missing data on redirects (#3975) 2018-06-18 14:24:45 -04:00
stevegt a7aaacb633 fix CreateIssueCommentOption reference (#4239)
* fixes a warning remaining from #4010 and #4220
2018-06-15 15:47:13 +08:00
David Schneiderbauer adba2ad609 fix not respecting landing page setting (#4209)
* fix not respecting landing page setting

* fmt

* add landing page test
2018-06-15 11:42:46 +08:00
Antoine GIRARD 6efdcaed86 Fix swagger security parts (#4236) 2018-06-12 19:23:00 -04:00
Antoine GIRARD 908e8942cc Fix swagger errors (#4220)
Fix all the resting errors to have a valid swagger file.

They are still some warnings but nothing blocking.

Doing so I found that some request still misses son parameters for some POST/PUT/PATCH request. This means the a client generated from the swagger file will not work completely. 

Fix #4088 by activating validation in drone
Should fix #4010.
2018-06-12 22:59:22 +08:00
nickolas360 2bb73fe12c HTML-escape text READMEs (#4192) 2018-06-10 21:42:16 +03:00
stevegt a5f63fc4d1 swagger: add 'required: true' for params in URL (#4097)
* Partial fix for #4010

Swagger validation needs 'required: true' for parameters that are in
the URL path.

Signed-off-by: Steve Traugott <stevegt@t7a.org>
2018-06-02 18:20:28 +03:00
stevegt 39f2aa7c12 add simple descriptions for file API responses (#4089)
* Partial fix for #4010

Swagger needs a description field in each swagger:operation response.  Adding
minimal text for now on the way to getting swagger validate to pass.  Many
standard swagger client libraries will not work with gitea until validate
passes, so prioritizing that over better descriptions for now.

Signed-off-by: Steve Traugott <stevegt@t7a.org>
2018-06-01 13:51:49 +08:00
stevegt 7707ad7a0a add simple descriptions for swagger validate (#4087)
* Partial fix for #4010

Swagger needs a comment line above each swagger:response comment -- it
uses these to populate the description: fields.  Adding minimal text
for now on the way to getting swagger validate to pass.  Many standard
swagger client libraries will not work at all with gitea until validate
passes, so prioritizing that over better descriptions for now.

Signed-off-by: Steve Traugott <stevegt@t7a.org>
2018-05-31 19:13:55 +08:00
Alexey Terentyev f86f56e19c Added deletion of an empty line at the end of the file (#4050) (#4054)
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
2018-05-29 11:08:55 +08:00
Michael Kuhn fd274ffcd9 Fix wiki redirects (#3919)
When creating or editing a wiki page, the redirect to the wiki page does
not work because the file name is used instead of the page name.
2018-05-28 09:38:20 -04:00
Fluf 2a9799493a Make home.tmpl visible with Signin-View enabled (#4040)
Fix #3846
2018-05-24 15:51:28 -04:00
Magnus Lindvall cdb9478774 LDAP Public SSH Keys synchronization (#1844)
* Add LDAP Key Synchronization feature

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>

* 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
Alexey Terentyev b908ac9fab Added repository search ordered by stars or forks. Forks column in admin repo list. (#3969)
* Added repository search order by stars or forks.
Added Forks column to admin repository list.

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>

* Renamed search repo template

Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
2018-05-24 09:03:42 +08:00
Lunny Xiao 60d95a0b85
fix bugs caused by #3929 (#3999) 2018-05-23 15:23:23 +08:00
Aleksandr Bulyshchenko ee878e3951 Support secure cookie for csrf-token (#3839)
* dep: Update github.com/go-macaron/csrf

Update github.com/go-macaron/csrf with dep to revision 503617c6b372
to fix issue of csrf-token security.

This update includes following commits:
- Add support for the Cookie HttpOnly flag
- Support secure mode for csrf cookie

Signed-off-by: Aleksandr Bulyshchenko <A.Bulyshchenko@globallogic.com>

* routers: set csrf-token security depending on COOKIE_SECURE

Signed-off-by: Aleksandr Bulyshchenko <A.Bulyshchenko@globallogic.com>
2018-05-22 02:09:48 +03:00
David Schneiderbauer 31067c0a89 remove collaborative repositories from search on user profiles (#3996)
* remove collaborative repositories from search on user profiles

* rename 'My Repositories' to 'Repositories'
2018-05-21 23:07:34 +03:00
Lunny Xiao 6bdc556b7f
Fix some webhooks bugs (#3981)
* fix some webhooks bugs

* update vendor

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

* fix test

* fix clearlabels

* fix pullrequest webhook bug fix #3492

* update release webhook description

* remove unused code

* fix push webhook in pull request

* small changes
2018-05-21 10:28:29 +08:00
Jonas Franz 951309f76a Add support for FIDO U2F (#3971)
* Add support for U2F

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

* Add vendor library
Add missing translations

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

* Minor improvements

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

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

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

* Add U2F login page to OAuth

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

* Move U2F user settings to a separate file

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

* Add unit tests for u2f model
Renamed u2f table name

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

* Fix problems caused by refactoring

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

* Add U2F documentation

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

* Remove not needed console.log-s

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

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

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2018-05-19 17:12:37 +03:00
David Schneiderbauer 44754774f1 Re-enable random avatar feature (#3988)
* reenable random avatar feature

* replace Size check by Filename check
2018-05-19 21:22:09 +08:00
David Schneiderbauer 2aabfc1afa Splitted the user settings code into several files to be more maintainable (#3968)
* refactor setting router code

splitted up one huge router settings file into the smaller files
representing the actual page structure

* move code to subfolder

* rename functions

* renamed files

* add copyright information
2018-05-17 12:05:00 +08:00
Lunny Xiao 24941a1046
Add more webhooks support and refactor webhook templates directory (#3929)
* add more webhook support

* move hooks templates to standalone dir and add more webhooks ui

* fix tests

* update vendor checksum

* add more webhook support

* move hooks templates to standalone dir and add more webhooks ui

* fix tests

* update vendor checksum

* update vendor

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

* load attributes when created release

* update comparsion doc
2018-05-16 22:01:55 +08:00
David Schneiderbauer 099372d76c Refactor User Settings (#3900)
* moved avatar to profile page

* combined password change, email and account deletion into account settings page

* combined totp, access tokens, linked accounts and openid into security settings page

* move access tokens to applications settings page

* small change to restart drone build

* fix change avatar url on profile page

* redirect old settings urls to new ones

* enforce only one autofocus attribute on settings pages

* set correct redirect status code

* fmt fix
2018-05-15 13:07:32 +03:00
FabioFortini 1546458f7d issue-2768: added new option allow_only_external_registration (#3910) 2018-05-13 15:51:16 +08:00
Lunny Xiao c14870c5ac
fix blank topic (#3948) 2018-05-11 16:15:18 +08:00
kolaente 95f2e2b57b Multiple assignees (#3705) 2018-05-09 19:29:04 +03:00
David Schneiderbauer ea01decb6b fix wrong issue endpoints in swagger doc (#3914) 2018-05-08 14:05:18 +08:00
Lauris BH 501fb228e6
Add option to use paged LDAP search when synchronizing users (#3895) 2018-05-05 17:30:47 +03:00
kolaente 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 BH 1e1ece8f3d
Do not allow to reuse TOTP passcode (#3878) 2018-05-02 18:02:02 +03:00
kolaente 1a97030017 Issue due date (#3794)
* Started adding deadline to ui

* Implemented basic issue due date managing

* Improved UI for due date managing

* Added at least write access to the repo in order to modify issue due dates

* Ui improvements

* Added issue comments creation when adding/modifying/removing a due date

* Show due date in issue list

* Added api support for issue due dates

* Fixed lint suggestions

* Added deadline to sdk

* Updated css

* Added support for adding/modifiying deadlines for pull requests via api

* Fixed comments not created when updating or removing a deadline

* update sdk (will do properly once go-gitea/go-sdk#103 is merged)

* enhanced updateIssueDeadline

* Removed unnessecary Issue.DeadlineString

* UI improvements

* Small improvments to comment creation
+ ui & validation improvements

* Check if an issue is overdue is now a seperate function

* Updated go-sdk with govendor as it was merged

* Simplified isOverdue method

* removed unessecary deadline to 0 set

* Update swagger definitions

* Added missing return

* Added an explanary comment

* Improved updateIssueDeadline method so it'll only update `deadline_unix`

* Small changes and improvements
* no need to explicitly load the issue when updating a deadline, just use whats already there
* small optimisations

* Added check if a deadline was modified before updating it

* Moved comment creating logic into its own function

* Code cleanup for creating deadline comment

* locale improvement

* When modifying a deadline, the old deadline is saved with the comment

* small improvments to xorm session handling when updating an issue deadline
+ style nitpicks

* style nitpicks

* Moved checking for if the user has write acces to middleware
2018-05-01 22:05:28 +03:00
Lauris BH 181b3a8f09 Fix path cleanup in multiple places (#3871) 2018-05-01 09:46:04 +08:00
Ethan Koenig 7ea4bfc561 API endpoint for testing webhook (#3550)
* API endpoint for testing webhook

* Empty commit to rerun CI
2018-04-29 14:21:33 +08:00
Lauris BH 5a62eb30df
Store OAuth2 session data in database (#3660)
* Store OAuth2 session data in database

* Rename table to `oauth2_session` and do not skip xormstorage initialization error
2018-04-29 09:09:24 +03:00
Jonas Franz 8d5f58d834 Shows total tracked time in issue and milestone list (#3341)
* Show total tracked time in issue and milestone list
Show total tracked time at issue page

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

* Optimizing TotalTimes by using SumInt

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

* Fixing wrong total times for milestones caused by a missing JOIN
Adding unit tests for total times

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

* Logging error instead of ignoring it

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

* Correcting spelling mistakes

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

* Change error message to a short version

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

* Add error handling to TotalTimes
Add variable for totalTimes

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

* Introduce TotalTrackedTimes as variable of issue
Load TotalTrackedTimes by loading attributes of IssueList
Load TotalTrackedTimes by loading attributes of single issue
Add Sec2Time as helper to use it in templates

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

* Fixed test + gofmt

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

* Load TotalTrackedTimes via MilestoneList instead of single requests

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

* Add documentation for MilestoneList

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

* Add documentation for MilestoneList

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

* Fix test

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

* Change comment from SQL query to description

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

* Fix unit test by using int64 instead of int

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

* Fix unit test by using int64 instead of int

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

* Check if timetracker is enabled

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

* Fix test by enabling timetracking

Signed-off-by: Jonas Franz <info@jonasfranz.de>
2018-04-29 13:58:47 +08:00
Morgan Bazalgette e3028d124f don't reset team/repo count when updating team via API (#3831)
fixes #3600
2018-04-29 13:22:57 +08:00
Lunny Xiao bec69f702b
Add topic support (#3711)
* add topic models and unit tests

* fix comments

* fix comment

* add the UI to show or add topics for a repo

* show topics on repositories list

* fix test

* don't show manage topics link when no permission

* use green basic as topic label

* fix topic label color

* remove trace content

* remove debug function
2018-04-11 10:51:44 +08:00
Lunny Xiao 45d1fc03cb
fix go vet error (#3740) 2018-03-30 07:21:27 +08:00
Bo-Yi Wu 1c5cbc390b refactor: import order. (#3736) 2018-03-29 21:32:40 +08:00
Lauris BH ab5cc6f3a9 Correctly check http git access rights for reverse proxy authorized users (#3721) 2018-03-29 09:39:51 +08:00
Allen Wild 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 <allenwild93@gmail.com>
2018-03-27 22:13:20 +08:00
Chri-s 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
Chri-s e64aa18dc9 Change protected branch settings title to existing locale entry (#3694) 2018-03-21 20:12:49 +02:00
Alex Ward 4ebdcbc5df Fix style of "In your repositories" when selected (#3699)
Signed-off-by: Alex Ward <alxwrd@googlemail.com>
2018-03-20 23:39:14 +02:00
Lunny Xiao 9e5d0a09eb
Global code search support (#3664)
* add global code search on explore

* fix bug when no anyone public repos

* change the icon

* fix typo and add UnitTypeCode check for login non-admin user

* fix ui description when no match
2018-03-16 22:04:33 +08:00
Lauris BH 7b2b900e13 Refactor and simplify redirect to url (#3674) 2018-03-15 22:13:34 +01:00
Chri-s a2a49c93c7 Added checks for protected branches in pull requests (#3544)
* Added checks for protected branches in pull requests

Signed-off-by: Christian Wulff <NChris@posteo.net>

* Moved check for protected branch into new function CheckUserAllowedToMerge

Signed-off-by: Christian Wulff <NChris@posteo.net>

* Removed merge conflict lines from last commit

Signed-off-by: Christian Wulff <NChris@posteo.net>

* Explicit check for error type in ViewIssue

Signed-off-by: Christian Wulff <NChris@posteo.net>
2018-03-13 11:46:14 +08:00
Lauris BH c0d41b1b77 Add label descriptions (#3662)
* Add label descriptions

* Add default descriptions to label template
2018-03-13 10:03:55 +08:00
kolaente 1a83581121 Added issue search via api (#3612)
* Started implementing issue api search

* Implemented issue search via api

* Added search to swagger.json

* Removed todo

* fmt

* Added comment to generate swagger json via "generate-swagger"

* Simplified search

* fmt

* Removed unessecary comment

* Removed unessecary declaration of the issues-variable

* Removed unessecary comment

* Removed unessecary comment

* Added explanation keyword

* Simplified check for empty keyword

* corrected check if keyword is empty
2018-03-07 12:00:56 +02:00
Jonas Franz 9a5e628a7e Add Attachment API (#3478)
* Add Attachment API
* repos/:owner/:repo/releases (add attachments)
* repos/:owner/:repo/releases/:id (add attachments)
* repos/:owner/:repo/releases/:id/attachments
* repos/:owner/:repo/releases/:id/attachments/:attachment_id

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

* Add unit tests for new attachment functions
Fix comments

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

* fix lint

* Update vendor.json

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

* remove version of sdk

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

* Fix unit tests
Add missing license header

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

* Add CreateReleaseAttachment
Add EditReleaseAttachment
Add DeleteReleaseAttachment

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

* Add filename query parameter for choosing another name for an attachment

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

* Fix order of imports

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

* Restricting updatable attachment columns

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

* gofmt

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

* Update go-sdk
Replace Attachments with Assets

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

* Update go-sdk

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

* Updating go-sdk and regenerating swagger

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

* Add missing file of go-sdk

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

* Change origin of code.gitea.io/sdk to code.gitea.io/sdk
Update code.gitea.io/sdk

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

* Update swagger

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

* Update updateAttachment
2018-03-06 09:22:16 +08:00
Mahmoud Al-Qudsi 171914e9a7 Log attachment blocked events (#3615)
Include both a log entry and the blocked mime type in the gitea log when
an attachment upload is blocked.

Chosen log level is info; this may need to be dialed down to trace.
2018-03-05 08:51:10 +08:00
Allen Wild 8606d9f5bc Add admin dashboard option to run health checks (#3606)
There's one for git gc, why not git fsck too?

Also add a couple more trace logs to GitFsck to see progress
2018-03-02 11:09:43 +02:00
Morgan Bazalgette 535445c32e Rework special link parsing in the post-processing of markup (#3354)
* Get rid of autolink

* autolink in markdown

* Replace email addresses with mailto links

* better handling of links

* Remove autolink.js from footer

* Refactor entire html.go

* fix some bugs

* Make tests green, move what we can to html_internal_test, various other changes to processor logic

* Make markdown tests work again

This is just a description to allow me to force push in order to restart
the drone build.

* Fix failing markdown tests in routers/api/v1/misc

* Add license headers, log errors, future-proof <body>

* fix formatting
2018-02-27 09:09:18 +02:00
bugreport0 521945a2d2 Fix missing translations when updating username. (#3564)
* Fix missing translations when updating username.

* Fix reserved username translated string test.

* Fix 'username reserved' string test a bit more.
2018-02-25 15:56:25 +02:00
Bo-Yi Wu 04b3e8cbdc
refactor: reduce sql query in retrieveFeeds (#3547) 2018-02-21 18:55:34 +08:00
Ethan Koenig 7b104f0cd0 Populate URL field of API commits (#3546)
* Populate URL field of API commits

* fix orgmode_test
2018-02-20 20:50:42 +08:00
Codruț Constantin Gușoi 96c268c0fc Implements generator cli for secrets (#3531)
Signed-off-by: Codruț Constantin Gușoi <codrut.gusoi@gmail.com>
2018-02-18 20:14:37 +02:00
Piotr Orzechowski b104ab3ca1 Add option to enable or disable swagger endpoints (#3502) 2018-02-14 06:46:00 +02:00
Ethan Koenig 4c9d9c221a Improve wiki test (#3493) 2018-02-13 11:19:49 +02:00
Lauris BH 283e87d814
Fix rendering of wiki page list if wiki repo contains other files (#3454)
* Fix rendering of wiki page list if wiki repo contains other files

* Improve wiki filename tests
2018-02-05 16:56:30 +02:00
Morgan Bazalgette 17655cdf1b Enable caching on assets and avatars (#3376)
* Enable caching on assets and avatars

Fixes #3323

* Only set avatar in user BeforeUpdate when there is no avatar set

* add error checking after stat

* gofmt

* Change cache time for avatars to an hour
2018-02-04 00:37:05 +02:00
Lauris BH ca4f5c37e6
Fix branch deletion for squash or rebase merged pull requests (#3425) 2018-01-30 14:29:39 +02:00
Lauris BH ca306985d3
Change how merged PR commit info are prepared (#3368)
* Change how merged PR commits and diff are made

* Update code.gitea.io/git dependency

* Fix typo

* Remove unneeded local variable
2018-01-19 08:18:51 +02:00
Marc Brückner 695b10bedd Fix API-Endpoint release (#3012)
* Fixes API-Endpoint release (#3005)

* Using context.ReferencesGitRepo(); doing the same in the PATCH route.

* Add release create, get and update test
2018-01-16 10:54:13 +02:00
Morgan Bazalgette eb0f166f50 Address issues pointed out by @lunny in #3339 (#3352) 2018-01-12 08:37:30 -06:00
Kim "BKC" Carlbäcker e5b8b4b5ec Cleanup models.User.HashPassword (#3334) 2018-01-12 00:19:38 +02:00
Morgan Bazalgette 65861900cd Handle refactor (#3339)
* Replace all ctx.Handle with ctx.ServerError or ctx.NotFound

* Change Handle(403) to NotFound, avoid using macaron's NotFound
2018-01-10 23:34:17 +02:00
Antoine GIRARD 84feb016f5 Remove useless fmt.Errorf("%v", err) (#3337) 2018-01-09 16:40:05 -02:00
Morgan Bazalgette 674cfb7cac Change EncodePasswd to HashPassword (#3329)
* Change EncodePasswd to HashPassword

* Create test+benchmark for HashPassword
2018-01-08 23:28:18 +01:00
Deyong Zhu d663cef2a5 Fix branch name escaping in compare url (#3311)
* Fixes #3303
2018-01-08 17:17:24 +02:00
Sandro Santilli 44053532bb Serve .patch for pull requests (#3305)
* Serve .patch for pull requests

Closes #3259
Updates "git" module, for GetFormatPatch

* Handle io.Copy error
2018-01-07 15:10:20 +02:00
Vlad Temian 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 BH 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 Santilli a192f3052e Serve pull request .diff files (#3293)
* Serve pull request .diff files

Closes #3259

* Add test for pull request redirection and .diff access

* Typo

* There's no need to test for pr.BaseRepo being nil after calling GetBaseRepo
2018-01-05 12:56:52 +02:00
Ethan Koenig ce7ae17b81 Fix swagger docs (#3300) 2018-01-04 14:31:40 +08:00
Elouan Martinet 5057c6b43f Fix guide link for webhooks in repository settings (#3291) (#3292)
Signed-off-by: Elouan Martinet <exa@elou.world>
2018-01-03 23:50:09 +08:00
Ethan Koenig 4c9341f689 Fix bugs in issue dashboard stats (#3073) 2017-12-26 01:25:16 +02:00
Ethan Koenig 515cdaa85d Fix ignored errors when checking if organization, team member (#3177) 2017-12-21 09:43:26 +02:00
Lunny Xiao 529482135c
Support default private when creating or migrating repository (#3239)
* support default private when creating or migrating repository

* fix fmt

* use string constants on repository default private in app.ini

* fix fmt
2017-12-20 06:59:56 -06:00
Ethan Koenig 0e384c6376 Check ignored errors for issue and milestone count (#3213) 2017-12-18 16:06:51 +02:00
Ethan Koenig befa7445d2 Unit tests for routers/repo/issue_label (#3198) 2017-12-15 23:11:02 +02:00
Lunny Xiao f94c1b3943
Improvements for supporting UI Location (#3146)
* improvements for supporting UI Location

* improved the comment
2017-12-14 07:45:31 +08:00
Lauris BH d3c5911ffc Fix wiki page list not rendering after updatedunix changes (#3175) 2017-12-13 21:46:56 +08:00
harry 03ec35ed79 Mention completion for issue editor. (#3136)
* new issue mention

* Mention completion on new issue and view issue page.

* Code format.

* Require tribute in pull request page.
2017-12-11 14:03:04 +08:00
Lunny Xiao f2e20c81b6 Refactor struct's time to remove unnecessary memory usage (#3142)
* refactor struct's time to remove unnecessary memory usage

* use AsTimePtr simple code

* fix tests

* fix time compare

* fix template on gpg

* use AddDuration instead of Add
2017-12-11 06:37:04 +02:00
Antoine GIRARD ef78309b65 Improve LFS tests + fix lfs url refs + keep path upper/lowercase in db. (#3092)
* Add failing test

* Fix urls

* Improve url in tests

* improve testing

* Remove debug code

* Add deps

* LFS corner-case : Search on lower but store with case

* Temporary comment of blocking action

* fix hooks

* Use temporary repo for git client test

* Use userPassword in place of hard-coded password
2017-12-08 20:21:37 +08:00
Ethan Koenig 596308f213 Fix missing branch in release bug (#3108) 2017-12-08 13:22:02 +08:00
Ethan Koenig 68179dc676 Remove unnecessary function call (#3109) 2017-12-08 09:02:34 +08:00
Sasha Varlamov 311c83ad17 Allow adding collaborators with (fullname) (#3103)
* Allow adding collaborators with (fullname)

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>

* Refactor username suffix to utils pkg

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>
2017-12-07 15:00:09 +08:00
Sasha Varlamov 7ec6cddd27 Add 'mark all read' option to notifications (#3097)
* Add 'mark all read' option to notifications

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>

* Fix exported comment

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>

* Format method comments

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>

* Fix exported comment

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>

Format method comments

Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>

Tests for reactions (#3083)

* Unit tests for reactions

* Fix import order

Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>

Fix reaction possition when there is attachments (#3099)

Refactor notifications swap function

* Accept change to drop beforeupdate call

* Update purge notifications error message for consistency

* Drop unnecessary check for mark all as read button

* Remove debugging comment
2017-12-07 13:52:57 +08:00
Vlad Temian 469ab99e9a Delete a user's public key via admin api (closes #3014) (#3059)
* Delete a user's public key via admin api

* Test admin ssh endpoint for creating a new ssh key

* Adapt public ssh key test to also test the delete operation

* Test that deleting a missing key will result in a 404

* Test that a normal user can't delete another user's ssh key

* Make DeletePublicKey return err

* Update swagger doc
2017-12-06 12:27:10 +02:00
Ethan Koenig c0a7899416 Sort repos in issues dashboard sidebar (#3072)
* Sort repos in issues dashboard sidebar

* Sort repos by name
2017-12-04 12:39:01 +08:00
Ethan Koenig 3c1b1ca78e Fix error message sanitiziation (#3082) 2017-12-04 03:48:03 +02:00
Lauris BH 5dc37b187c
Add reactions to issues/PR and comments (#2856) 2017-12-04 01:14:26 +02:00
Lunny Xiao b3d5ba6f90 Fix missing password length check when change password (#3039)
* fix missing password length check when change password

* add tests for change password
2017-12-02 19:11:22 +02:00
Lunny Xiao 35cc5b0402
Remove GetRepositoryByRef and add GetRepositoryByOwnerAndName (#3043)
* remove GetRepositoryByRef and add GetRepositoryByOwnerAndName

* fix tests

* fix tests bug

* some improvements
2017-12-02 15:34:39 +08:00
Piotr Orzechowski 57edc3155f Default log level to Info without hardcoding it in installer (#3041) 2017-12-01 15:41:27 +08:00
Lunny Xiao 13e59c8b7a remove unused variable (#3038) 2017-11-30 20:44:25 +02:00
Ethan Koenig 91f3d77ceb Unit tests for wiki routers (#3022) 2017-11-30 17:52:15 +02:00
Sandro Santilli 67b0d2175d Set OpenID support on by default when installing new instance (#3010) 2017-11-29 14:47:42 +02:00
Duncan Ogilvie 551f3cbe42 Memory usage improvements (#3013)
* govendor update code.gitea.io/git

Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>

* Greatly improve memory usage

Signed-off-by: Duncan Ogilvie <mr.exodia.tpodt@gmail.com>
2017-11-29 09:50:39 +08:00
Antoine GIRARD 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
Antoine GIRARD d99f4ab003 Git LFS lock api (#2938)
* Implement routes

* move to api/sdk and create model

* Implement add + list

* List return 200 empty list no 404

* Add verify lfs lock api

* Add delete and start implementing auth control

* Revert to code.gitea.io/sdk/gitea vendor

* Apply needed check for all lfs locks route

* Add simple tests

* fix lint

* Improve tests

* Add delete test + fix

* Add lfs ascii header

* Various fixes from review + remove useless code + add more corner case testing

* Remove repo link since only id is needed.

Save a little of memory and cpu time.

* Improve tests

* Use TEXT column format for path + test

* fix mispell

* Use NewRequestWithJSON for POST tests

* Clean path

* Improve DB format

* Revert uniquess repoid+path

* (Re)-setup uniqueness + max path length

* Fixed TEXT in place of VARCHAR

* Settle back to maximum VARCHAR(3072)

* Let place for repoid in key

* Let place for repoid in key

* Let place for repoid in key

* Revert back
2017-11-28 22:58:37 +02:00
Vlad Temian 6ad4990a65 Add fingerprint to ssh key endpoints. (#3009)
* Add fingerprint to ssh key endpoints.

* Update gitea sdk vendor
2017-11-28 17:21:39 +02:00
Ethan Koenig b7ebaf6d20 Various wiki bug fixes (#2996)
* Update macaron

* Various wiki bug fixes
2017-11-28 17:43:51 +08:00
Lauris BH 0d4c63fd70
Fix go-get, src and raw urls to new scheme (#2978) 2017-11-27 02:58:54 +02:00
Ethan Koenig 716ac1214f Enable admin to search by email (#2888) 2017-11-26 16:40:38 +08:00
Lunny Xiao 061c501d54 Fix error when add user has full name to team (#2973)
* fix error when add user has full name to team

* add comment for extra uname check
2017-11-26 10:01:48 +02:00
Ethan Koenig 40c545ddbc Fix files/commits of merged PRs (#2937) 2017-11-25 21:47:19 +08:00
Timur Makarchuk dbb7715b0b Remove render issue link (#2954)
* Remove function that does nothing

* Remove unused import
2017-11-22 08:25:47 +02:00
Lunny Xiao 10b54df2b2 Add dingtalk webhook (#2777)
* add dingtalk webhook type

* add vendor

* some fixes

* fix name check

* fix name check & improvment
2017-11-21 06:26:43 +02:00
Michael Kuhn 420fc8efc2 Disable add key button if SSH is disabled (#2873) 2017-11-21 11:49:33 +08:00
schaffman5 7e6c198f21 Apply LANDING_PAGE config options for logged in users (#2894)
* Extended LANDINGPAGE config variable to logged in users and added switch for 'organizations' in addition to 'home' and 'explore'.

* Updated comments.

Signed-off-by: Mike Schaffer <mschaff@gmail.com>

* Extended LANDINGPAGE config variable to trigger when user logs in and added switch for 'organizations' in addition to 'home' and 'explore'.

Signed-off-by: Mike Schaffer <mschaff@gmail.com>

* Extended LANDINGPAGE config variable to logged in users and added switch for 'organizations' in addition to 'home' and 'explore'.

* Updated comments.

Signed-off-by: Mike Schaffer <mschaff@gmail.com>

* Extended LANDINGPAGE config variable to trigger when user logs in and added switch for 'organizations' in addition to 'home' and 'explore'.

Signed-off-by: Mike Schaffer <mschaff@gmail.com>

* Removed superfluous conditional and correct whitespace.

Signed-off-by: Mike Schaffer <mschaff@gmail.com>

* Update app.ini

Reverted new line.

* Formatting.

Signed-off-by: Mike Schaffer <mschaff@gmail.com>
2017-11-20 15:48:09 +08:00
Ethan Koenig c3b6383b3a Fix comment API paths (#2813) 2017-11-20 15:24:07 +08:00
Ethan Koenig 876bafb7ef Fix API status code for hook creation (#2814)
* Fix API status code for hook creation

* Named constants for response statuses
2017-11-20 15:00:53 +08:00
Ethan Koenig d22a8dc022 Page parameter for repo search API (#2915) 2017-11-15 16:10:26 +08:00
Ethan Koenig f26f4a7e01 Update swagger documentation (#2899)
* Update swagger documentation

Add docs for missing endpoints
Add documentation for request parameters
Make parameter naming consistent
Fix response documentation

* Restore delete comments
2017-11-13 09:02:25 +02:00
Lauris BH ba2e0240c6
Add LFS object verification step after upload (#2868)
* Add LFS object verification step after upload

* Fix file verification condition and small refactor

* Fix URLs

* Remove newline and return status 422 on failed verification

* Better error hadling
2017-11-08 15:04:19 +02:00
Lunny Xiao cdc4600725
Fix fork repository cycle to self (#2860)
* fix fork repository cycle to self

* rename testForkRepo to traverseParentRepo
2017-11-06 12:12:55 +08:00
Ethan Koenig d91fe5254d Fix ignored errors in API route (#2850)
* Fix ignored errors in API route
2017-11-04 19:10:01 +01:00
Lauris BH 08b124dd47
Fix API raw requests for commits and tags (#2841) 2017-11-04 01:23:59 +02:00
Guillaume Dube 8798cf4e3b Set session and indexers' data files rel to AppDataPath (#2192)
* Set session and indexers' data files rel to AppDataPath

The setting AppDataPath is now relative to the working directory.
The session svc's PROVIDER_CONFIG now defaults to AppDataPath/data/sessions.
The issue indexer's IssuePath now defaults to AppDataPath/indexers/issues.bleves.

* fix bug
2017-11-03 10:56:20 +02:00
Cum Gun eecaba2031 Configurable SSH key exchange algorithm and MAC suite (#2806) 2017-11-02 23:26:41 +08:00
Ethan Koenig e6a97b6675 Use api.TrackedTime in API (#2807)
* Use api.TrackedTime in API

* APIFormat() method

* Rename function
2017-11-01 10:25:14 +08:00
Ethan Koenig 513375c429 Make URL scheme unambiguous (#2408)
* Make URL scheme unambiguous

Redirect old routes to new routes

* Fix redirects to new URL scheme, and update template

* Fix branches/_new endpoints, and update integration test
2017-10-30 10:04:25 +08:00
Ethan Koenig 5866eb2321 Code/repo search (#2582)
Indexed search of repository contents (for default branch only)
2017-10-27 09:10:54 +03:00
Morlinest ddb7f59ef4 Add search mode option to /api/repo/search (#2756)
* Add repo type option to /api/repo/search

* Add tests and fix result of collaborative filter in specific condition

* Fix/optimize search & tests

* Improve integration tests

* Fix lint errors

* Fix unit tests

* Change and improve internal implementation of repo search

* Use NonexistentID

* Make search api more general

* Change mirror and fork search behaviour

* Fix tests & typo in comment
2017-10-27 00:16:13 +03:00
Lauris BH eca05b09aa Add commit count caching (#2774)
* Add commit count caching

* Small refactoring

* Add different key prefix for refs and commits

* Add configuratuion option to allow to change caching time or disable it
2017-10-26 09:37:33 +08:00
Bwko 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 Xiao 178bd498b9
fix imports 2017-10-25 13:30:29 +08:00
Lunny Xiao 219ca5cadb
some fixes 2017-10-25 13:26:14 +08:00
Lunny Xiao 6eeadb2082 Hide unactive on explore users and some refactors (#2741)
* hide unactive on explore users and some refactors

* fix test for removed Organizations

* fix test for removed Organizations

* fix imports

* fix logic bug

* refactor the toConds

* Rename TestOrganizations to TestSearchUsers and add tests for users

* fix other tests

* fix other tests

* fix watchers tests

* fix comments and remove unused code
2017-10-24 20:36:19 +03:00
Antoine GIRARD 619b9b5547 Move swagger-ui under /api/v1 (#2746)
* Move swagger interface under /api/v1

* Update swagger-ui

* Add /api/swagger and prepare for multiple api version

* Update test links

* Fix footer link
2017-10-21 22:05:50 +08:00
spacetourist 7131c7d40d Configurable SSH cipher suite (#913)
* Configurable SSH cipher suite

* Update configuration file comment

* Add default in settings loading code

* Fix fmt and log messsage

* Remove default from code as this could probably might not be good idea
2017-10-21 16:13:41 +03:00
Morlinest ccd3577970 Fix repository search function (#2689)
* Fix and remove FIXME

* Respect membership visibility

* Fix/rewrite searchRepositoryByName function

* Add unit tests

* Add integration tests

* Remove Searcher completely

* Remove trailing space
2017-10-17 23:20:22 +08:00
Jonas Franz f4190f8df8 Render plain text README.txt monospaced (#2721)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
2017-10-17 02:17:22 +03:00
Lunny Xiao 9e865cee67 Merge password and 2fa page on user settings (#2695)
* merge password and 2fa page on user settings
2017-10-16 11:14:12 +02:00
Lauris BH c1b0c9e7c4 Fix PR, milestone and label functionality if issue unit is disabled (#2710)
* Fix PR, milestone and label functionality if issue unit is disabled or not assigned to user

* Fix multi-actions in PR page

* Change error message

* Fix comment update and delete functionality in PR
2017-10-16 10:55:43 +03:00
Lunny Xiao a75d5c72bb Fix plain readme didn't render correctly on repo home page (#2705)
* fix plain readme didn't render correctly on repo home page

* fix missing render

* remove unused template variables
2017-10-16 09:04:34 +02:00
Lauris BH c7f4f07765 Integration test for activity page (#2704)
* Integration test for activity page

* Small code refactoring for acitvity page

* Move activity stats calculation logic to model
2017-10-16 00:54:53 +03:00
Lauris BH f3833b7ce4 Create new branch from branch selection dropdown (#2130)
* Create new branch from branch selection dropdown and rewrite it to VueJS

* Make updateLocalCopyToCommit as not exported

* Move branch name validation to model

* Fix possible race condition
2017-10-15 22:59:24 +03:00
David Schneiderbauer 4ccb0fe338 fix .netrc authentication (#2700)
* provide both possible authentication solutions

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
2017-10-15 18:35:43 +03:00
Lauris BH 1ec4dc6c1d Fix so that user can still fork his own repository to owned organizations (#2699)
* Fix so that user can still fork his own repository to his organizations

* Fix to only use owned organizations

* Add integration test for forking own repository to owned organization
2017-10-15 18:06:07 +03:00
Lauris BH 32ca299650 Remove direct user adding to organization members (#2641) 2017-10-15 10:24:24 +08:00
Lauris BH f42dbdbae5 Add Activity page to repository (#2674)
* Add Activity page to repository

* Add request data for activity

* Add issue data for activity

* Add user unit right checks

* Add releases to activity

* Log repository unit loading error
2017-10-15 02:17:39 +03:00
Morlinest dff26e25ca Remove redudant functions and code (#2652)
* Remove redudant functions and code
2017-10-10 22:37:18 +02:00
David Schneiderbauer 0cef8ce192 fix panic on gogs webhook creation (#2675)
* fix panic on gogs webhook creation

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>

* fix panic in gogs webhook edit

Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
2017-10-08 19:37:31 +08:00
Kazuki Sawada 43253202e9 Change default sort order (#2647)
* sort repositories by `updated_unix` in Explore

* Fix UI problem

* Added missing sort order "newest"

* Change default sort order

* fmt
2017-10-05 08:02:43 +03:00
Kazuki Sawada e1266a19c8 Change pull description text (#2075) (#2646)
* Change pull description text

* move duplicated code into helper function
2017-10-04 20:35:01 +03:00
Morlinest a04718a2a6 Remove repo unit index (#2621)
* Remove repo unit index

* Fix sqlite
2017-10-02 23:22:25 +03:00
Morlinest 1ad902d529 Fix implementation of repo Home func (#2601)
* Fix implementation of repo Home func

* Make fixture changes for testing
2017-10-01 16:50:56 +03:00
Morlinest bae9cbce9c Remove redudant CheckUnit calls in router (#2627) 2017-09-30 12:04:16 +08:00
Morlinest cc84ca40d7 Remove redudant issue LoadAttributes() calls (#2614) 2017-09-27 09:41:52 -03:00
Lunny Xiao 2ef8b8bcbe fix go get subpackage bug (#2584)
* fix go get subpackage bug

* merge the duplicated funtions
2017-09-23 16:24:24 +03:00
Morlinest 9a75a5d59b Use custom type and constants to hold order by options (#2572) 2017-09-22 15:53:21 +03:00
Lunny Xiao 1be2b4a262 fix readme view bug (#2566) 2017-09-21 21:24:19 +03:00
Lunny Xiao 0d80af649a Add init support of orgmode document type on file view and readme (#2525)
* add init support of orgmode document type on file view and readme

* fix imports

* fix imports and readmeExist

* fix imports order

* fix format

* remove unnecessary convert
2017-09-21 13:20:14 +08:00
Lauris BH 7a0297819d Sync releases table with tags on push and for mirrors (#2459)
* Sync releases table with tags on push and for mirrors

* Code style fixes

* Fix api to return only releases

* Optimize release creation and update
Minimize posibility of race conditions

* Fix release lower tag name updating

* handle tag reference update by addionally comparing commit id
2017-09-20 13:26:49 +08:00
Lauris BH 23645fe05f Sort repository tree entries in natural way (#2506)
* Sort repository tree entries in natural way

* Fix sort for different length strings with first parts equal

* Improve test case

* Refactor return statements

* Update gitea/git dependency
2017-09-19 11:37:03 +03:00
Jonas Franz 566e8ecce0 Fork permission bug fixes (#2534)
* Hotfix for "Add time manually" (https://github.com/go-gitea/gitea/pull/2211#issuecomment-328780125)

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

* Checking if Code unit is enabled before creating a fork.

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

* Adding a discrete function for RepoIDAssignment

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

* Improved Documentation
2017-09-18 22:52:20 +08:00
Ethan Koenig b0f7457d9e Improve issue search (#2387)
* Improve issue indexer

* Fix new issue sqlite bug

* Different test indexer paths for each db

* Add integration indexer paths to make clean
2017-09-16 23:16:21 +03:00
Lunny Xiao 52e11b24bf Restructure markup & markdown to prepare for multiple markup language… (#2411)
* restructure markup & markdown to prepare for multiple markup languages support

* adjust some functions between markdown and markup

* fix tests

* improve the comments
2017-09-16 20:17:57 +03:00
Rémy Boulanouar e5d80b7090 Implementation of all repositories of a user from user->settings (#1740)
* Implementation of all repositories of a user from user->settings

* Update message when no repository found

* Update according to comments

* Change UI to have a better look

* improved user repositories UI
2017-09-14 14:46:14 +03:00
Lunny Xiao 1739e84ac0 improve protected branch to add whitelist support (#2451)
* improve protected branch to add whitelist support

* fix lint

* fix style check

* fix tests

* fix description on UI and import

* fix test

* bug fixed

* fix tests and languages

* move isSliceInt64Eq to util pkg; improve function names & typo
2017-09-14 16:16:22 +08:00
Rémy Boulanouar be3319b3d5 Display commit status on landing page of repo (#1784)
* Display commit status on landing page of repo

* improve last status of commits and add link to ci

* fix last commit status since the order of ids are desc
2017-09-14 14:51:31 +08:00
Jonas Franz 633de01cf7 Hotfix for "Add time manually" (https://github.com/go-gitea/gitea/pull/2211#issuecomment-328780125) (#2499)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
2017-09-13 21:02:04 +02:00
Jonas Franz 5ccecb44ad Feature: Timetracking (#2211)
* Added comment's hashtag to url for mail notifications.
* Added explanation to return statement + documentation.
* Replacing in-line link generation with HTMLURL. (+gofmt)
* Replaced action-based model with nil-based model. (+gofmt)
* Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants.
* Updating comment for mailIssueCommentToParticipants
* Added link to comment in "Dashboard"
* Deleting feed entry if a comment is going to be deleted
* Added migration
* Added improved migration to add a CommentID column to action.
* Added improved links to comments in feed entries.
* Fixes #1956 by filtering for deleted comments that are referenced in actions.
* Introducing "IsDeleted" column to action.
* Adding design draft (not functional)
* Adding database models for stopwatches and trackedtimes
* See go-gitea/gitea#967
* Adding design draft (not functional)
* Adding translations and improving design
* Implementing stopwatch (for timetracking)
* Make UI functional
* Add hints in timeline for time tracking events
* Implementing timetracking feature
* Adding "Add time manual" option
* Improved stopwatch
* Created report of total spent time by user
* Only showing total time spent if theire is something to show.
* Adding license headers.
* Improved error handling for "Add Time Manual"
* Adding @sapks 's changes, refactoring
* Adding API for feature tracking
* Adding unit test
* Adding DISABLE/ENABLE option to Repository settings page
* Improving translations
* Applying @sapk 's changes
* Removing repo_unit and using IssuesSetting for disabling/enabling timetracker
* Adding DEFAULT_ENABLE_TIMETRACKER to config, installation and admin menu
* Improving documentation
* Fixing vendor/ folder
* Changing timtracking routes by adding subgroups /times and /times/stopwatch (Proposed by @lafriks )
* Restricting write access to timetracking based on the repo settings (Proposed by @lafriks )
* Fixed minor permissions bug.
* Adding CanUseTimetracker and IsTimetrackerEnabled in ctx.Repo
* Allow assignees and authors to track there time too.
* Fixed some build-time-errors + logical errors.
* Removing unused Get...ByID functions
* Moving IsTimetrackerEnabled from context.Repository to models.Repository
* Adding a seperate file for issue related repo functions
* Adding license headers
* Fixed GetUserByParams return 404
* Moving /users/:username/times to /repos/:username/:reponame/times/:username for security reasons
* Adding /repos/:username/times to get all tracked times of the repo
* Updating sdk-dependency
* Updating swagger.v1.json
* Adding warning if user has already a running stopwatch (auto-timetracker)
* Replacing GetTrackedTimesBy... with GetTrackedTimes(options FindTrackedTimesOptions)
* Changing code.gitea.io/sdk back to code.gitea.io/sdk
* Correcting spelling mistake
* Updating vendor.json
* Changing GET stopwatch/toggle to POST stopwatch/toggle
* Changing GET stopwatch/cancel to POST stopwatch/cancel
* Added migration for stopwatches/timetracking
* Fixed some access bugs for read-only users
* Added default allow only contributors to track time value to config
* Fixed migration by chaging x.Iterate to x.Find
* Resorted imports
* Moved Add Time Manually form to repo_form.go
* Removed "Seconds" field from Add Time Manually
* Resorted imports
* Improved permission checking
* Fixed some bugs
* Added integration test
* gofmt
* Adding integration test by @lafriks
* Added created_unix to comment fixtures
* Using last event instead of a fixed event
* Adding another integration test by @lafriks
* Fixing bug Timetracker enabled causing error 500 at sidebar.tpl
* Fixed a refactoring bug that resulted in hiding "HasUserStopwatch" warning.
* Returning TrackedTime instead of AddTimeOption at AddTime.
* Updating SDK from go-gitea/go-sdk#69
* Resetting Go-SDK back to default repository
* Fixing test-vendor by changing ini back to original repository
* Adding "tags" to swagger spec
* govendor sync
* Removed duplicate
* Formatting templates
* Adding IsTimetrackingEnabled checks to API
* Improving translations / english texts
* Improving documentation
* Updating swagger spec
* Fixing integration test caused be translation-changes
* Removed encoding issues in local_en-US.ini.
* "Added" copyright line
* Moved unit.IssuesConfig().EnableTimetracker into a != nil check
* Removed some other encoding issues in local_en-US.ini
* Improved javascript by checking if data-context exists
* Replaced manual comment creation with CreateComment
* Removed unnecessary code
* Improved error checking
* Small cosmetic changes
* Replaced int>string>duration parsing with int>duration parsing
* Fixed encoding issues
* Removed unused imports

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2017-09-12 09:48:13 +03:00
Antoine GIRARD 7c417bbb0d Only check at least one email gpg key (#2266)
* Only require one email (possibly not yet validated)

* Update message error and check validation of commit

* Add integrations tests

* Complete integration for import

* Add pre-check/optimization

* Add some test (not finished)

* Finish

* Fix fixtures

* Fix typo

* Don't guess key ID
2017-09-05 21:45:18 +08:00
Ethan Koenig b689bb6180 Webhooks for repo creation/deletion (#1663)
* Webhooks for repo creation/deletion

* add createHookTask

* Add handles for GetSlackPayload and GetDiscordPayload
2017-09-03 11:20:24 +03:00
Lunny Xiao 04ec79579c fix orgnization webhooks (#2422)
* fix org webhooks

* remove trace code
2017-08-30 13:36:52 +08:00
Lunny Xiao 3e6fed368b fix webhook test (#2415)
* fix webhook test

* fix error message

* fix typo
2017-08-29 22:55:24 +08:00
Ethan Koenig 491f0ebc58 Fix route handler order (#2409)
* Fix route handler order

* Fix more routes
2017-08-29 14:53:51 +08:00
Lunny Xiao 15d3872281 fix missing orgnization discord webhook (#2414) 2017-08-29 09:20:35 +08:00
Lunny Xiao ced50e0ec1 Implementation of discord webhook (#2402)
* implementation of discord webhook

* fix webhooks

* fix typo and unnecessary color values

* fix typo

* fix imports and revert changes to webhook_slack.go
2017-08-28 13:06:45 +08:00
Lunny Xiao e41da3845d fix duplicated feed (#2370) 2017-08-28 10:26:04 +08:00
Lunny Xiao f61a1d210c Fix missing collabrative repos (#2367)
* fix missing collabrative repos

* fix bug of collabrative

* fix SQL quotes
2017-08-24 22:01:03 +08:00
Zsombor da230a2872 Add possibility to record branch or tag information in an issue (#780) 2017-08-24 15:30:27 +03:00
David Schneiderbauer 174255e74e Log failed authentication attempts with remote address for fail2ban (#2334)
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
2017-08-24 08:57:54 +03:00
Bwko 1a5fe4326f Add collaborative repositories to the dashboard (#2205)
* Add collaborative repositories to the dashboard

Remove some unused code from the Dashboard func

* fix some bug and some refactor

* fix tests
2017-08-23 09:30:54 +08:00
Antoine GIRARD fd8e8a421a Improve swagger doc (#2274)
* Add swagger comment for adminCreateOrg

* Add swagger comment for admin route

* add hook swagger doc

* Add tags

* Add auth

* Fix name of responses

* Edit name method

* Update vendor

* make generate-swagger
2017-08-21 14:13:47 +03:00
Sandro Santilli 2c3a229a3c Add OpenID configuration in install page (#2276) 2017-08-19 17:34:49 +02:00
David Schneiderbauer 5707ad3bb7 Add AppURL without trailing slash to TOTP issuer parameter to prevent conflicting accounts on multiple gitea installations (#2335)
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
2017-08-19 09:39:43 +08:00
Morlinest e08d1fcc15 Fix variable name typo (#2327) 2017-08-18 14:21:46 +03:00
Michael Kuhn 934dd41fa6 Make SHOW_USER_EMAIL also apply to profiles (#2258)
The e-mail address is currently only hidden from the explore page.
2017-08-17 17:08:03 +08:00
Ethan Koenig 7907786040 Trigger sync webhooks on UI commit (#2302)
* Trigger sync webhooks on UI commit

* Also fix UI upload/delete
2017-08-17 15:22:08 +08:00
Morlinest 951fb572a7 Fix and improve dashboard repo UI (#2285)
* Fix and improve dashboard repo UI

* Change order of scripts loading

* Remove "mirror" tab

* Remove single tab panel for "org user"

* Add localization strings

* Create vue component and change event for search

* Add "mirrors" filter
2017-08-17 09:31:34 +08:00
Ethan Koenig 29f3a6e492 Fix rendering of external links (#2292) 2017-08-13 19:30:27 -03:00
Lunny Xiao f960e19c59 Only update needed columns when update user (#2296)
* only update needed columns when update user

* fix missing update_unix column
2017-08-12 22:18:44 +08:00
Ethan Koenig 7e0654bd9e Fix counts on issues dashboard (#2215)
* Fix counts on issues dashboard

* setupSess -> setupSession

* Unit test

* Load repo owners for issues
2017-08-03 13:09:16 +08:00
Ethan Koenig f29458bd3a EnableUnit() -> UnitEnabled() (#2242) 2017-08-02 11:46:54 +03:00
Bwko 1193627014 Fix Commits nil pointer dereference (#2203) 2017-07-31 09:23:10 +08:00
Florian / sinnlosername 27c2dcf60e Fixed robots.txt 404 error (#2226)
* Update routes.go

* Update routes.go
2017-07-30 22:32:10 +08:00
Ethan Koenig 49df677c47 Check for access in /repositories/:id (#2227)
* Check for access in /repositories/:id

* Integration test
2017-07-30 09:13:33 +08:00
Lunny Xiao 04c4028aea
fix some bug 2017-07-28 13:49:36 +08:00
Ethan Koenig fd45a032a7 Fix bare-repo bugs (#2199)
* Fix bare-repo bugs

* Integration tests

* Unused import
2017-07-27 12:23:38 +03:00
Moritz Heiber 7e12aac61c Only allow token authentication with 2FA enabled (#2184)
* Don't allow for plain username/password authentication when 2FA is enabled

* Removed debugging statement

* Don't assume a token belongs to a given user, handle two-factor errors properly

* Simplified user/token matching, refactored error handling for two-factor authentication

* Change authentication response to avoid bruteforcing

* Add TODO item as a comment for changing the response for security purposes
2017-07-26 15:33:16 +08:00
Bwko 8f171210b9 Revert "Add ability to fork your own repos (#761)" (#2193) 2017-07-26 15:17:38 +08:00
Lauris BH f33e6ae09e Remove unit types commits and settings (#2161)
* Remove unit types commits and settings

* Can not limit units in administrator teams

* Limit changing units only to teams with read and write access mode

* Small code optimization
2017-07-17 10:04:43 +08:00
Christian Weiske c4ccf16c43 Fix OpenID registration route (#2160)
Fixes #2101
2017-07-13 23:58:53 +03:00
Aaron Walker 6a3c03762a API: support '/orgs/:org/repos' (#2047)
* API: support '/orgs/:org/repos'
2017-07-13 13:14:15 +02:00
Ethan Koenig 93a1de4842 Fix repo API bug (#2133)
Don't require token when not necessary
2017-07-12 03:23:41 +02:00
Ethan Koenig 8f1d62ad3b Fix GET /users/:username/repos endpoint (#2125) 2017-07-10 14:07:39 +03:00
Antoine GIRARD 30787e48f2 Improve org error handling (#2117)
* Improve ErrOrgNotExist type
Return new error type
Use good error check
Use new method to check error
Update tests

* Fix unchanged method name report
2017-07-06 21:30:19 +08:00
Lauris BH f189ccd2d6 Fix git hooks update to receive required arguments. Fixes #2090 (#2095)
* Changed migration calling so that migrations can use models package
2017-07-02 21:50:57 +08:00
Ethan Koenig f99489d5c5 Fix API for branches with slashes (#2096) 2017-07-02 10:03:57 +08:00
Lauris BH 783b1967e2 Fix release display and correct paging (#2080) 2017-06-29 23:11:38 +08:00
iszla 3f9016430f Pagination on releases page (#2035)
* Added count to GetReleasesByRepoID so pagination will work

* Separated it out to a new function, can then also leave the API part unaffected

* Remove extra whitespace added in untouched function

* Added comment and corrected name in error handler

* Account for if the user is owner or not in the count

* Also check if repo is draft

* revert back to the correct count in the ReleasesToDisplay loop

* Fixed lint error regarding else with return statement

* Use Cond struct instead of string, corrected name in error handler

* Removed unused return variable names
2017-06-28 22:47:00 +08:00
Shuanglei Tao d389ed25a5 Fix: `http: multiple response.WriteHeader calls` (#2038)
We can't change the http status code here, because the response has been written.
2017-06-28 14:08:47 +08:00
Lauris BH 32fc44aa83 Make time diff translatable (#2057) 2017-06-28 13:43:28 +08:00
Jonas Franz 441986a473 Fix "Dashboard shows deleted comments" (#1995) 2017-06-25 20:20:29 +02:00
Ethan Koenig 735676267e Integration tests for issues API (#2059) 2017-06-25 22:51:07 +08:00
Ethan Koenig 2559a34b97 Load label ID in NewLabels (#2045) 2017-06-25 14:15:09 +08:00
Ethan Koenig 3ffedeab03 Fix bug in issue labels API (#2048) 2017-06-25 07:52:51 +08:00
Kim "BKC" Carlbäcker cc6b3f60c6 Fix displaying commits and files of PR created from now deleted fork (#2023)
Fix displaying commits and files of PR created from now deleted fork
2017-06-22 19:40:47 +02:00
Lunny Xiao 228247511a repo/editor: fix breadcrumb path cuts parent dirs (#3859) (#2032) 2017-06-22 23:30:47 +08:00
Lunny Xiao 75b5be236a Display config file path on admin panel (#2030) 2017-06-22 08:21:56 -05:00
Lunny Xiao d71fad2ab7 Fix #2001 and fix issue comments hidden (#2016)
* revert #2001 and fix issue comments hidden

* fix #2001

* fix import

* improve comment type

* reduce unnecessary join

* fix comment on FindCommentsOptions
2017-06-21 09:00:44 +08:00
Lauris BH 0a5dc640a1 Make branch deletion URL more like GitHub's, fixes #1397 (#1994)
* Make branch deletion URL more like GitHub's, fixes #1397

* Add PR branch deletion integration test

* Do not allow deleting protected branch

* Change http error code to 403 if user has no write rights to repository

* Add check to not panic if forked repository has alrady been deleted
2017-06-21 09:00:03 +08:00
Lauris Bukšis-Haberkorns 63504bf132
Fix displaying commits and files of PR created from now deleted forked repository 2017-06-21 01:25:38 +03:00
Ethan Koenig 4df1a24096 Let not-logged-in users view releases (#1999) 2017-06-18 11:38:24 +08:00
Bo-Yi Wu b7812be33a fix misspell (#1996)
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-06-18 08:30:04 +08:00
Ethan Koenig 8fc64741d9 Fix deleted milestone bug (#1942)
* Fix deleted milestone bug

* Use locale for ghost milestone name

* Fix pointer bug
2017-06-17 12:51:28 +08:00
Antoine GIRARD 2bcd9471c9 Separate generate swagger + fix sed os specific (#1791)
* Separate generate-swagger

* Remove go generate rules

* Add missing definition replacement + remove use of -i sed flag

for compatibility with mac os default sed version.
This is a little hacky a better solution could be use.

* Use custom SED_INPLACE

depending of platform detection

* Use SED_INPLACE for swagger-ui also
2017-06-15 08:51:23 -05:00
Ethan Koenig 8fcda0442e Fix search by issue type (#1914)
* Fix search by issue type
2017-06-15 05:09:03 +02:00
Ethan Koenig 5e92b82ac6 Fix uppercase default branch bug (#1965) 2017-06-14 08:42:36 +08:00
Jonas Östanbäck ad70af1248 Add repo fork swagger (#1941) 2017-06-12 08:59:51 +08:00
Dennis Keitzel 96b4780727 Gracefully handle bare repositories on API operations. (#1932)
Signed-off-by: Dennis Keitzel <github@pinshot.net>
2017-06-10 21:57:28 -05:00
silverwind f2fcd9dcd8 Support CRLF when splitting code lines for display (#1862)
* Support CRLF when splitting code lines for display

* refactor, fix mixed match

* fmt

* split on both LF and CRLF, use raw literals in regexes

* simplify
2017-06-10 23:20:25 +08:00
Ethan Koenig afe1f1c4af Fix 500 in public activity page (#1901) 2017-06-08 03:48:49 -05:00
Ethan Koenig 9ddc35e343 Cache ctx.User in retrieveFeeds (#1902) 2017-06-08 10:11:41 +08:00
Andrey Nering 65cf6cc848 Merge pull request #1905 from ethantkoenig/fix/org_api_auth
Require token before checking membership/ownership
2017-06-07 16:49:52 -03:00
Andrey Nering a70073e768 Merge pull request #1904 from ethantkoenig/fix/org_api
Bug fixes for org member API
2017-06-07 16:49:33 -03:00
Ethan Koenig 971e3a35c1 Require token before checking membership/ownership 2017-06-07 12:20:32 -04:00
Ethan Koenig f38842320e Bug fixes for org member API 2017-06-07 12:10:35 -04:00
camlafit 952cb8046f A missing / to provide a correct endpoint
solve #1899
2017-06-07 17:57:28 +02:00
Bo-Yi Wu 703d18e50d feat: add check misspelling (#1877) 2017-06-05 02:49:46 -05:00
Ethan Koenig 023cad4461 gofmt (#1868) 2017-06-04 11:10:16 +08:00
Ethan Koenig 817a405118 Fix paginater length (#1866) 2017-06-04 11:07:20 +08:00
Ethan Koenig 2ec5dc1661 Fix 404 for external tracking issues (#1852)
* Fix 404 for external tracking issues

* Fix 404 for new/upload file
2017-06-03 00:56:36 -05:00
Ethan Koenig b900c04316 Display draft releases (#1854)
* Display draft releases

* Include ctx.User in user cache

* Integration test
2017-06-03 11:46:56 +08:00
Rémy Boulanouar 62f600cf1c Display all organization from user settings (#1739)
* Display all organization from user settings

* fix Tab selection

* Update locale_en-US.ini

* Add a condition for display Create organization button

* Remove french translation

* Remove unnecessary admin flag
2017-06-02 03:43:44 -05:00
Antoine GIRARD 976c2a05fa Fix change introduce by update of go-swagger. (#1727) 2017-06-01 23:35:31 -05:00
Ethan Koenig 4e5ee2b67a Fix user profile activity feed (#1848)
* Fix user profile activity feed

* gofmt, and avoid overlapping database connections
2017-06-02 08:42:25 +08:00
Jonas Östanbäck b93568cce4 xxx_active_code_live setting in printed in hours and minutes instead … (#1814)
* xxx_active_code_live setting in printed in hours and minutes instead of just hours

* Update app.ini description of xxx_code_lives settings
2017-05-29 02:35:47 -05:00