Commit graph

2088 commits

Author SHA1 Message Date
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
Morlinest
0f2c98adcd Fix "index out of range" runtime error in repo_list tests (#2376) 2017-08-28 09:33:38 +08:00
Manuel
d9d8fad230 Add UseCompatSSHURI setting (#2356)
* Add UseCompatSSHURI setting

Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com> (+1 squashed commits)

Squashed commits:

[dda2dc79] Add ForceCloneSSHURL setting

Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com>

* Make protocol if construct more readable

Signed-off-by: Manuel Kroeber <manuel.kroeber@gmail.com>
2017-08-26 15:57:41 +02: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
Lunny Xiao
64b7068846 Add more test for login links and fix a bug on action retrieve (#2361)
* add more test for login links and fix a bug on action retrieve
2017-08-23 12:53:35 +03:00
Ethan Koenig
fd6e91077a Fix SQL condition bug in GetFeeds(..) (#2360) 2017-08-23 08:51:58 +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
Lunny Xiao
2c6a0fdca8 update latest xorm version to vendor (#2353) 2017-08-22 14:39:52 +03: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
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
Lunny Xiao
921d90fd8b fix 500 error when view an issue which's milestone deleted (#2297) 2017-08-12 10:15:30 +08:00
G
34df9deff1 Convert xorm literal queries to method calls (#2253) 2017-08-04 12:42:51 +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
G
66e8262530 Replace calls to xorm UseBool with Where (#2237) 2017-08-01 13:47:31 +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
Ethan Koenig
a27863b6d1 Fix issue updated_unix bug (#2204) 2017-07-27 09:20:38 +08:00
Ethan Koenig
5f37944dff Fix unclosed session bug (#2214) 2017-07-26 17:30:47 +08:00
Lauris BH
1d032f5220 Fix compiling without sqlite and gcc (#2177) 2017-07-26 15:27:30 +08:00
Ethan Koenig
48898e5d0b Fix PR nil-dereference bug (#2195)
* Fix PR nil-dereference bug

* Revert to original error format
2017-07-26 15:16:45 +08:00
Lauris BH
dde0052ca2 Fix key usage time update if the key is used in parallel for multiple operations (#2185) 2017-07-20 11:15:10 +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
Lauris BH
b639fa1648 Ignore invalid issue numbers in commit messages. Fixes #2022 (#2150) 2017-07-12 22:35:47 -05:00
Ethan Koenig
858324c21a Fix username rendering bug (#2122)
* Fix username rendering bug

* XSS integration test

* Migration to unescape user full names
2017-07-12 17:58:52 +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
Ethan Koenig
a52cd59727 Fix unchecked error bug (#2110) 2017-07-04 09:30:41 +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
eae9154811 Fix SQL bug in models.PullRequests 2017-07-01 14:08:43 +03:00
Lauris BH
12cb6cd3c9 Merge pull request #2087 from Bwko/fix_error_exit
Fix exit status 1 not handled @ getMergeCommit (#2087)
2017-06-30 15:46:49 +03:00
Bwko
b36849dc1f
Fix exit status 1 not handled @ getMergeCommit 2017-06-30 12:35:26 +02:00
Andrey Nering
935b40fd8e Merge pull request #2083 from ethantkoenig/check_err/org_avatar
Don't ignore gravatar error
2017-06-29 21:30:05 -03:00
Ethan Koenig
05e3726415 Use default avatar on error 2017-06-29 12:10:33 -04:00
Lauris BH
783b1967e2 Fix release display and correct paging (#2080) 2017-06-29 23:11:38 +08:00
Lunny Xiao
33f3165296 remove unnecessary blank lines and wrong error log 2017-06-28 19:00:08 +02: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
Lauris BH
32fc44aa83 Make time diff translatable (#2057) 2017-06-28 13:43:28 +08:00
Dan Magnus Lindvall
79daf31058 Setting to disable authorized_keys backup (#1856)
* Add setting to disable authorized_keys backup when rewriting public keys

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

* Update default value to comply with documentation

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

* Use tmp-file instead of bak-file for saving manually added keys.

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

* Change casing

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

* Change casing and build bakpath with sprintf only

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

* Only close file once

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

* Do not modify calcFingerprint

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

* Fix casing

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

* Change style from disable to enable

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

* Change name, just SSH_BACKUP_AUTHORIZED_KEYS

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

* Do not check for directory existence if backup is disabled

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>
2017-06-28 09:35:35 +08:00
Ethan Koenig
80707c4736 Fix default ghost assignee bug (#2069) 2017-06-28 09:27:12 +08:00
Jonas Franz
441986a473 Fix "Dashboard shows deleted comments" (#1995) 2017-06-25 20:20:29 +02:00
Ethan Koenig
2559a34b97 Load label ID in NewLabels (#2045) 2017-06-25 14:15:09 +08:00
Győrvári Gábor
f2afed3098 Enable assignee e-mail notification (#2003)
* Enable assignee e-mail notification

* Check assignee and doer to avoid self made comment notifications.

* Assignee not always defined

* New method to avoid error when assignee deleted

* Assignee empty check
2017-06-23 21:43:37 +08:00
Ethan Koenig
902a749fd9 Fix fast-forward PR bug (#1989) 2017-06-22 09:06:57 +08: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
6db387a21e Refactor session close as xorm already does everything needed internally (#2020) 2017-06-21 08:57:05 +08:00
Lauris BH
165cf33771 Wrong PR merge commit ID saved (#2007) 2017-06-19 17:37:11 +08:00
Ethan Koenig
255adc40ae Don't show non-comments in comments API (#2001) 2017-06-18 17:06:17 +08:00
Lauris BH
1a906f800d Fix GPG email checking to be case insensitive (#1988) 2017-06-17 18:56:40 +08:00
Lunny Xiao
e2ec4b7c23 fix bu ong normal user visit public repo (#1984) 2017-06-17 12:53:51 +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
Ethan Koenig
ce9b86082c Consolidate boilerplate in integration tests (#1979) 2017-06-17 12:49:45 +08:00
Ethan Koenig
8fcda0442e Fix search by issue type (#1914)
* Fix search by issue type
2017-06-15 05:09:03 +02:00
Kim "BKC" Carlbäcker
bf48c8ebdd SQLite has a query timeout. Hopefully fixes most 'database locked' errors (#1961)
* SQLite has a query timeout. Fixes 'database locked' errors
2017-06-15 04:51:17 +02:00
Lunny Xiao
31b5e9177f fix collborators lack of units on orgnization repositories (#1968)
* fix collborators lack of units on orgnization repositories

* also change log level to debug
2017-06-15 04:50:12 +02:00
Ethan Koenig
57cabb3ad3 Fix diff of renamed and modified file (#1967) 2017-06-14 04:07:09 -05:00
Antoine GIRARD
274149dd14 Switch to keybase go-crypto (for some elliptic curve key) + test (#1925)
* Switch to keybase go-crypto (for some elliptic curve key) + test

* Use assert.NoError 

and add a little more context to failing test description

* Use assert.(No)Error everywhere 🌈

and assert.Error in place of .Nil/.NotNil
2017-06-14 08:43:43 +08:00
Ethan Koenig
96152c38b1 Fix bug in Action.loadRepo() (#1959) 2017-06-14 08:37:50 +08:00
Ethan Koenig
b38b61bbc1 Fix import order (#1951) 2017-06-12 10:01:09 -05:00
Andrey Nering
635273cea6 Merge pull request #1829 from ethantkoenig/no_branches
Commitless repos should be bare
2017-06-12 11:05:01 -03:00
Ethan Koenig
9fbdd7d787 Fix engine bug in getIssueByID (#1934) 2017-06-11 14:39:12 +08:00
Ethan Koenig
e0a63a20e0 Fix errors caused by force push (#1927) 2017-06-10 21:59:13 -05: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
Ethan Koenig
73836ce8c4 Fix ghost user bug (#1913)
Fix bug where unassigned issues would appear to be assigned to a ghost user
2017-06-09 09:51:31 +08:00
Dan Magnus Lindvall
ff7424179e Delete Public SSH Key tmp file after calculating fingerprint (#1855)
* Delete public key tmp file after calculating fingerprint

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

* Move line

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

* Remove defer statement

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

* Readd defer statement and move remove

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

* Delete space

Signed-off-by: Magnus Lindvall <magnus@dnmgns.com>
2017-06-08 10:08:22 +08:00
Sandro Santilli
f6b58964d7 Include formatting check to the make test (and thus also check) rule (#1366)
* Include formatting check to the `make check` rule

... and give it its own standalone target too (make fmt-check)

Show diff on fmt-check failure
Do not allow running "fmt-check" with incompatible go version
Also simplify the `fmt` rule

* Forbid running "make fmt" with Go version != 1.7 or 1.8

* Ignore bindata.go for spelling and formatting checks

also remove duplicated variable assignment for GOFILES

* Run `make fmt`
2017-06-06 08:53:16 -05:00
Phil Hopper
6ec07a6bd7 Make LocalCopyPath a setting instead of a hard-coded path (#1881) 2017-06-06 04:09:54 -05:00
Ethan Koenig
ca9169fbe9 Migration to fix existing owner team units (#1873) 2017-06-05 05:40:25 -05:00
Bo-Yi Wu
703d18e50d feat: add check misspelling (#1877) 2017-06-05 02:49:46 -05:00
Andrey Nering
ed31dff5ab Merge pull request #1874 from ethantkoenig/typo/issue_test
Fix misspelled variables
2017-06-04 17:10:40 -03:00
Ethan Koenig
9f9289fc68 Run unused test 2017-06-04 14:28:17 -04:00
Ethan Koenig
1a09afc729 Fix misspelled variables 2017-06-04 13:39:08 -04:00
Ethan Koenig
3e74b5cf51 Rename misnamed migration (#1867) 2017-06-04 11:09:50 +08: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
Ethan Koenig
036ce3f813 Fix bug in removeOrgRepo (#1858) 2017-06-02 20:06:09 -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
Ethan Koenig
a977ab7889 Don't ignore error in getMergeCommit (#1843) 2017-05-31 19:51:24 -05:00
Ethan Koenig
336e311a7c Fix locking bug in removeOrgRepo (#1842) 2017-06-01 08:41:14 +08:00
Ethan Koenig
5554165a0c Fix pull request compare link (#1832)
* Fix pull request compare link

* Integration test
2017-05-31 09:47:42 -05:00
Ethan Koenig
bfb44f8854 Fix status table race condition (#1835) 2017-05-31 16:57:17 +08:00
Ethan Koenig
474d636794 Update code.gitea.io/git (#1824)
* Update code.gitea.io/git

* Update function calls

* govendor fetch
2017-05-30 04:32:01 -05:00
Ethan Koenig
367ff327ed Use ghost users in issues/PRs (#1831) 2017-05-30 14:08:36 +08:00
Timo Myyrä
2525195749 use writeTmpKeyFile in calcFingerprint (#1828)
this makes calcFingerprint use SSH.KeyTestpath instead of os temp dir.
2017-05-29 19:51:16 +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
Rémy Boulanouar
e0c6ab2d44 Add Gitea Webhook (#1755)
* Replace Gogs by Gitea

* Fix missing changes

* Create Gitea webhook and put Gogs webhook apart.
2017-05-29 02:17:15 -05:00
Ethan Koenig
c85ff532e9 Commitless repos should be bare 2017-05-28 22:31:40 -04:00
Ethan Koenig
bafd778c25 Fix invalid reference in feeds template (#1820)
* Fix invalid reference in feeds template

* Comment for GetActAvatar

* Add integration test
2017-05-27 11:34:11 +08:00
Ethan Koenig
7e6ff69c00 Fix 500 for GET /teams/:id endpoints (#1811)
* Fix 500 for GET /teams/:id endpoints

* Integration test for GET /team/:id

* Clean up integration test
2017-05-26 08:15:45 -05:00
Ethan Koenig
39348cd27e Give all units to owner team (#1812) 2017-05-26 16:03:37 +08:00
Ethan Koenig
9c66d1d9ea Fix deadlock in updateRepository (#1813) 2017-05-26 13:08:13 +08:00
Ethan Koenig
0c332f0480 Fix activity feed (#1779)
* Fix activity feed

Preserve actions after user/repo name change

* Add missing comment

* Fix migration, and remove fields completely

* Tests
2017-05-26 09:38:18 +08:00
Jonas Franz
03912ce014 Adding #issuecomment to the URL in E-Mail notifications (#1674)
* Added comment's hashtag to url for mail notifications.

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

* Added comment's hashtag to url for mail notifications.
Added explanation to return statement.

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

* Added comment's hashtag to url for mail notifications.
Added explanation to return statement + documentation.

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

* Added comment's hashtag to url for mail notifications.

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

* Replacing in-line link generation with HTMLURL. (+gofmt)

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

* Replaced action-based model with nil-based model. (+gofmt)

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

* Replaced mailIssueActionToParticipants with mailIssueCommentToParticipants.

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

* Updating comment for mailIssueCommentToParticipants

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2017-05-25 10:38:56 +08:00
Lunny Xiao
19d889daa2 fix bug not to trim space of login username (#1796) 2017-05-25 00:12:00 +08:00
Jonas Östanbäck
7b907ed348 Rename RepoCreationNum -> MaxCreationLimit (#1766) 2017-05-24 08:27:08 +08:00
Ethan Koenig
bdc90aeaee Delete repo redirects on repo deletion (#1776) 2017-05-23 16:00:10 +08:00
Ethan Koenig
b0308d86dc Fix unloaded owner (#1770) 2017-05-21 14:35:45 +08:00
Ethan Koenig
cf02cd7ba0 Fix and test for delete user (#1713)
* Fix and test for delete user

* Run updates in batches

* Unit test
2017-05-20 16:48:22 +08:00
Jonas Östanbäck
80cea8747f Admin should always be allowed to create repos even if hit limit (#1765) 2017-05-20 11:51:19 +08:00
Kim "BKC" Carlbäcker
977dcf96e0 fixes wrong after field in webhook payload (#1746) 2017-05-19 12:12:27 +02:00
Lunny Xiao
6362462da8
fix admin lost permission caused by #947 2017-05-19 08:59:26 +08:00
Lunny Xiao
fd6034aaf2 Add units to team (#947)
* add units to team

* fix lint

* finish team setting backend

* finished permission controll on routes

* fix import blank line

* add unit check on ssh/http pull and push and fix test failed

* fix fixtures data

* remove unused code
2017-05-18 22:54:24 +08:00
Diep Pham
407fbfa6ce fixes wrong after field in webhook payload
when merge pull request
2017-05-18 12:16:36 +07:00
Lunny Xiao
bc299b8317 fix avatar update bug (#1729) 2017-05-16 08:36:09 +08:00
Jonas Östanbäck
e214728725 Add new text for reset password flash (#1718)
* Forgot password should use ResetPwdCodeLives, not ActiveCodeLives
 * Improve documentation for different send mail functions related to password reset
 * Improve documentation in conf/app.ini regarding xxx_CODE_LIVE_MINUTES settings
2017-05-14 10:38:30 +08:00
Ethan Koenig
9e627af9a4 gofmt (#1710) 2017-05-12 16:09:53 +08:00
guyzmo
397474ecb1 Added Parent property to the repo API (#1687)
Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
2017-05-12 11:09:26 +08:00
Ethan Koenig
251fb935ff Don't recreate database in integration tests (#1697) 2017-05-11 23:32:43 +08:00
Lauris BH
524885dd65 LDAP user synchronization (#1478) 2017-05-10 15:10:18 +02:00
Andrey Nering
ab79069dc7 Improve dashboard repo search (#1652)
* Add VueJS

* Improve dashboard search

* Fix tab switching

* Fix input autofocus
2017-05-09 08:31:30 +08:00
Lauris BH
51d0becb42 Add configuration option for default permission to create Organizations (#1686) 2017-05-08 21:51:53 +02:00
Kim "BKC" Carlbäcker
a85c5ab9ff fix potential sqlite lock #1680 2017-05-08 10:02:44 +02:00
Lauris BH
79494047b0 Show commit status icon in commits table (#1688)
* Show commit status icon in commits table

* Add comments

* Fix icons

* Few more places where commit table is displayed

* Change integration test to use goquery for parsing html

* Add integration tests for commit table and status icons

* Fix status to return lates status correctly on all databases

* Rewrote lates commit status selects
2017-05-07 22:40:31 +08:00
Lunny Xiao
930d1759ae Remove env user salt since no need to use (#1515)
* remove env user salt since no need to use

* remove unused variable from update.go
2017-05-06 21:21:22 +08:00
guyzmo
98460a8d9d Exposes in API the Repo entity's Size and IsBare property (#1668)
* Exposes in API the Repo entity's IsBare property as IsEmpty

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>

* Exposes in API the Repo entity's Size property

Signed-off-by: Guyzmo <guyzmo+github+pub@m0g.net>
2017-05-05 10:55:54 +08:00
Lunny Xiao
36f02c0c32
fix potential sqlite lock 2017-05-05 10:13:48 +08:00
Lunny Xiao
0f3923c4d7 fix potential lock when sqlite (#1647) 2017-05-05 08:47:03 +08:00
Ethan Koenig
a5f28a4544 gofmt (#1662) 2017-05-04 13:54:56 +08:00
Lunny Xiao
1773e88643 Drop db operations from hook commands (#1514)
* move all database operations from hook command to web command and instead of internal routes

* bug fixed

* adjust the import path sequences

* remove unused return value on hookSetup
2017-05-04 13:42:02 +08:00
Antoine GIRARD
3edb0c5894 Generate swagger json (#1402)
- Generate swagger.json into public/
- Add swagger-ui auto-installation
- Add footer link to local swagger-ui
- Add /swagger url for using app url.
- Fix Swagger-UI version via git tag
2017-05-02 15:35:59 +02:00
Lauris BH
98548c83d3 Add primary key and index to external login user table (#1656) 2017-05-02 16:41:44 +08:00
Lauris BH
0144817971 Do not allow commiting to protected branch from online editor (#1502)
* Do not allow commiting to protected branch from online editor

* Add editor integration tests for adding new file and not allowing to add new file to protected branch
2017-05-02 08:49:55 +08:00
Willem van Dreumel
950f2e2074 Additional OAuth2 providers (#1010)
* add google+

* sort signin oauth2 providers based on the name so order is always the same

* update auth tip for google+

* add gitlab provider

* add bitbucket provider (and some go fmt)

* add twitter provider

* add facebook provider

* add dropbox provider

* add openid connect provider incl. new format of tips section in "Add New Source"

* lower the amount of disk storage for each session to prevent issues while building cross platform (and disk overflow)

* imports according to goimport and code style

* make it possible to set custom urls to gitlab and github provider (only these could have a different host)

* split up oauth2 into multiple files

* small typo in comment

* fix indention

* fix indentation

* fix new line before external import

* fix layout of signin part

* update "broken" dependency
2017-05-01 21:26:53 +08:00
Ethan Koenig
66c803fae2 MySQL, Postgres integration tests in drone (#1638)
* MySQL, Postgres integration tests in drone

* Fix .drone.yml

* sign drone

* resign drone
2017-04-30 14:30:12 +08:00
Jonas Östanbäck
9a8ca3e877 Fix broken migration v27 (#1504)
Mirror.interval column type needed to be changed to bigint.
Correct interval where the interval set is < MinInterval.
2017-04-30 10:08:16 +08:00
Lunny Xiao
e31c02d4bf fix bug on issue view when not login (#1624)
* fix bug on issue view when not login

* hide issue watch when not login

* update the tests

* fix test on issue
2017-04-29 13:52:25 +08:00
Jonas Östanbäck
e4a0a04829 Add create_at and updated_at in PR json (#1616)
* Move new fields to object creation (use reference)
 * Vendor: Update SDK
2017-04-27 17:29:46 +08:00
Antoine GIRARD
8371f94d06 Rework SSH key management UI to add GPG (#1293)
* Rework SSH key management UI to add GPG

* Add more detail to gpg key display

* Update CHANGELOG.md

* Implement deletion UI

* Implement adding gpg UI

* Various fixes

- Fix duplicate entry in locale
- Re-generate hash before verification since they are consumed

* Add missing translation

* Split template

* Catch not found/verified email error
2017-04-26 21:10:43 +08:00
Ethan Koenig
c58708d3ee Integration test framework (#1290)
* Integration test framework

* udpate drone sign

* Formatting fixes and move router.go to routers/

* update sign for drone
2017-04-25 15:24:51 +08:00
Lunny Xiao
3012971e92 fix bug on status API (#1533) 2017-04-24 22:33:54 +08:00
Kim "BKC" Carlbäcker
4bea219128 Status-API (#1332) 2017-04-21 19:32:31 +08:00
Bo-Yi Wu
fa2a513c62 feat: add download count field and unit testing for attachment. (#1512)
* feat: add download count field and unit testing.

* fix: unit testing

* refactor: improve testing.

* fix: update comment

* add default value.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-04-20 10:31:31 +08:00
Lunny Xiao
2eeae84cbd Add internal routes for ssh hook comands (#1471)
* add internal routes for ssh hook comands

* fix lint

* add comment on why package named private not internal but the route name is internal

* add comment above package private why package named private not internal but the route name is internal

* remove exp time on internal access

* move routes from /internal to /api/internal

* add comment and defer on UpdatePublicKeyUpdated
2017-04-19 11:45:01 +08:00
Kim "BKC" Carlbäcker
d409d3ab57 Sanitation fix from Gogs (#1461)
* Santiation fix from Gogs

* Linting

* Fix build-errors

* still not working

* Fix all the things!

* gofmt

* Add code-injection checks
2017-04-13 10:52:24 +08:00
Jonas
be6edaddcb Repo size in admin panel (#1482)
* Implementation of the feature to view repository size in admin panel
 * Move GetRepoSize to git module
 * Repository.RepoSize -> Repository.Size
 * RepoSize -> Size in template
 * Redo a few bits and pieces
 * Update size when syncing mirror or forking
 * Remove GetRepoSize
 * Changed fatal errors to error message

* Copy migration code from Gogs

* make fmt
2017-04-11 21:30:15 +08:00
Jonas
54f0293f0a Mirror sync interval specified as duration string (#1407)
* Sync interval specifed as duration string

* Changed mirror interval text

* make fmt

* Add MinInterval for mirror sync

* Use duration internally

* Changed min default to 10m

* make fmt

* Incorrect default

* Removed defaults in MustDuration()

* Add Mirror interval migration

* Default values corrected

* Use transaction during migration

* Change http 500 to page with error message

* Cleanup session.commit()
2017-04-08 23:27:26 +08:00
Lunny Xiao
5c0bee9b20 refactor update ssh key use time (#1466) 2017-04-07 17:40:38 -07:00
Lunny Xiao
5acfc7c4bc fix migrate failed and org dashboard failed on MSSQL database (#1448) 2017-04-06 18:47:25 -07:00
Jonas
e7493e953f Corrected Mirror.NextUpdate not set (#1388) 2017-04-05 17:56:45 -07:00
Kuba Tyszko
5d6b71fdbb fixes pull request hanging indefinitely when it contains normal and LFS file pointers (#1425) 2017-04-03 10:21:09 +08:00
Andrey Nering
37a34c1a28 Merge pull request #1410 from andreynering/notification/issue-watch
[Notifications Step 6] Per issue/PR watch/unwatch
2017-04-01 15:12:24 -03:00
Andrey Nering
f6e5ce65b2 Improve tests a little 2017-04-01 10:05:58 -03:00
Andrey Nering
e5c56fe30d Code style fixes 2017-04-01 09:58:20 -03:00
agrn
88112a5324 Fix "Error: No issue number specified" when pushing (#1393)
* Fix "Error: No issue number specified"  when pushing

* update pr
2017-03-31 18:05:39 -07:00
Mura Li
6a39250579 Add length check for the return string (#1420)
* Add length check for the return string

* Differentiate error paths and logging messages

* Rectify error message
2017-03-31 16:42:23 +08:00
Andrey Nering
e6781d5488 Add unit tests for issue_watch 2017-03-30 20:20:08 -03:00
Andrey Nering
a90ffffb1a Use variables for times 2017-03-30 19:14:16 -03:00
Andrey Nering
18952c40f8 Add copyright headers 2017-03-30 19:11:58 -03:00
Andrey Nering
caed86fc6e Fix lint 2017-03-29 21:18:28 -03:00
Andrey Nering
cb362513f0 Add updated_unix column on issue_watch 2017-03-29 20:59:28 -03:00
Andrey Nering
aa6e949b3d Consider issue_watchers while sending notifications 2017-03-29 20:54:57 -03:00
Andrey Nering
b674460748 Add watch button on issue 2017-03-29 20:31:47 -03:00
Andrey Nering
a0d0de7233 Create issue_watch table 2017-03-29 19:55:40 -03:00
Bo-Yi Wu
08f7fded3c refactor: remove workaround after the golang 1.7 release. (#1349)
* refactor: remove workaround after the golang 1.7 release.

* remove unused import.

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

* refactor: Add remove function.

* refactor: rename

* refactor: update build flag
2017-03-29 10:05:23 +08:00
Philippe Kueck
fe94032f74 rewrite pre-commit, post-commit and options hooks (fixes #1250) (#1257)
* issue #1250, replace {pre,post}-receive and update hooks with a single shell script that does not require custom hooks to be a sh-script

* issue #1250, make script posix compilant

* v23, add migration script to update {pre,post}-receive and update hooks

* migration: use a more common name and rename v23 to v26 to avoid conflicts

* gofmt'ed and added copyright header

* fix SyncRepositoryHooks to also sync wiki repos
2017-03-23 09:12:51 +08:00
Lunny Xiao
d330a23ce1 fix migration failed when authorized_keys is not exist (#1180) 2017-03-23 00:04:31 +08:00
Kim "BKC" Carlbäcker
d349f059af Cleaner IMO (#1361) 2017-03-22 22:30:40 +08:00
Antoine GIRARD
14fe9010ae GPG commit validation (#1150)
* GPG commit validation

* Add translation

+ some little fix

* Move hash calc after retrieving of potential key + missing translation

* Add some little test
2017-03-22 18:43:54 +08:00
Sandro Santilli
f73e734411 Run "make fmt" with go-1.6 (#1333) 2017-03-21 08:55:00 +08:00
Lunny Xiao
888dee3b5f fix delete user failed on sqlite (#1321) 2017-03-20 22:13:52 +08:00
Lunny Xiao
bd8fe49076 fix wiki bugs (#1294) 2017-03-20 21:36:19 +08:00
Sandro Santilli
9182a35f18 Show user OpenID URIs in their profile (#1314) 2017-03-20 09:31:08 +01:00
Lunny Xiao
608cd54a68 fix gpg wrong column types 2017-03-20 02:55:07 +01:00
Bo-Yi Wu
1c3bd436cc feat: Only use issue and wiki on repo. (#1297) 2017-03-18 18:59:07 +08:00
Sandro Santilli
71d16f69ff Login via OpenID-2.0 (#618) 2017-03-17 15:16:08 +01:00
Lunny Xiao
3cf0e513e6 fix wrong log when push to a new branch (#1220) 2017-03-17 10:15:00 +08:00
Sandro Santilli
447c9b428f Send notifications to partecipants in issue comments (#1217)
* Send notifications to partecipants in issue comments

Closes #1216

Includes test (still failing)

* Do not include "labelers" to participants

Fix test to expect what GetParticipants return
2017-03-16 09:34:24 +08:00
Antoine GIRARD
ca1c3f1926 Implement GPG api (#710)
* Implement GPG API

* Better handle error

* Apply review recommendation + simplify database operations

* Remove useless comments
2017-03-16 09:27:35 +08:00
Ethan Koenig
09fe4a2ae9 Batch updates for issues (#926) 2017-03-15 02:10:35 +01:00
Ethan Koenig
021904e4e6 Fix typos in models/ and modules/ (#1248) 2017-03-15 08:52:01 +08:00
Ethan Koenig
ec0ae5d50c Refactor and fix incorrect comment (#1247) 2017-03-15 08:51:46 +08:00
Sandro Santilli
8746fb3385 Fix migration comment (#1241) 2017-03-14 14:39:02 +08:00
Lunny Xiao
1ccdf19fae fix forget migration for wiki hooks (#1227) 2017-03-13 14:27:29 +08:00
Sandro Santilli
0475e7351f Reserve the "explore" user/org name (#1222) 2017-03-12 09:39:38 +08:00
Ethan Koenig
c99e7e1a62 Simplify RepositoryList.loadAttributes() (#1211) 2017-03-11 16:50:12 +08:00
Ethan Koenig
3803f257fb Move user_follow to separate file (#1210)
Also add unit tests
2017-03-11 16:46:53 +08:00
Ethan Koenig
1e3548b7e7 Unit tests for issue_list (#1209) 2017-03-11 16:46:23 +08:00
Philippe Kueck
e2b2fd6e78 fix #1189, commit messages containing a pipe (#1203) 2017-03-11 12:01:38 +08:00
Lunny Xiao
74cde12677 Fix upgrade failed after ever rollback (#1194)
* fix upgrade failed after rollback

* fix upgrade failed after rollback

* fix possible upgrade twice fail after rollback
2017-03-10 23:43:51 +08:00
Lunny Xiao
f5476bdbb1 bug fixed for delete repo failed (#1193) 2017-03-10 22:05:53 +08:00
Lunny Xiao
5d40db629c fix random avatars (#1147) 2017-03-08 23:05:15 +08:00
Lunny Xiao
2215840363 fix avatar bug #1114 (#1122)
This PR fix the avatar bug described in #1114. This will fix random avatar is blank problem and potential delete avatars dir problem.
2017-03-06 16:15:40 +08:00
Lunny Xiao
0376029241 fix del org avatar potential delete all avtars (#1120) 2017-03-06 16:07:18 +08:00
Lunny Xiao
7b64b2ddab fix install submit crash caused by xorm log (#1119) 2017-03-06 10:11:43 +08:00
Bo-Yi Wu
d76d67de23 feat: expose url field on issue api. (#982)
* Add api url func.

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

* fix: Add unit testing.

* fix: conflicts

* fix: remove trim

* fix: revert test function name.
2017-03-03 22:35:42 +08:00
Lunny Xiao
ef13bbaf7d Don't rewrite non-gitea public keys (#906)
* don't rewrite non-gitea public keys

* add comment for public key
2017-03-03 00:36:47 +08:00
Lunny Xiao
9cb08a3cf5 fix wrong num of user repos because of duplicated click delete button & performance optimization (#1092) 2017-03-01 12:05:45 +08:00
Ethan Koenig
d21d5fd736 Remove unnecessary loads in org_team (#1090) 2017-03-01 09:09:49 +08:00
Ethan Koenig
22f7aa6e9c LableIDs -> LabelIDs (#1088) 2017-03-01 09:08:45 +08:00
Bo-Yi Wu
e83c8afc56 refactor: move SearchRepositoryByName testing. (#1083) 2017-02-28 17:58:50 +08:00
Lunny Xiao
c2eef171ff fix some typos (#1082) 2017-02-28 12:56:15 +08:00
Ethan Koenig
4b286f282a Consistency checks for action unit tests (#1079) 2017-02-28 09:42:10 +08:00
Ethan Koenig
cf80e19157 Optimize and unit test Issue_ReplaceLabels (#1080) 2017-02-28 09:35:55 +08:00
Ethan Koenig
136e6beb0f Fix unused Engine bugs (#1064) 2017-02-27 10:16:35 +08:00
Lunny Xiao
e4134debd1 Remove unused vars (#1063)
* remove unused vars

* remove unused comment
2017-02-27 09:22:15 +08:00
Lunny Xiao
32faec00e6 move all repo list functions as a standalone file (#1061) 2017-02-27 08:45:03 +08:00
Lunny Xiao
d4e38cf129 fix setMerged for remove unnecessary db connection (#1067) 2017-02-27 08:42:55 +08:00
Lunny Xiao
522f194983 Bug fixed for org avatar caused by #1049 (#1070)
* bug fixed for org avatar caused by #1049

* use isfile only
2017-02-27 08:42:22 +08:00
Bo-Yi Wu
95574a3640 fix: Admin can see all private repositories on Explore page. (#1026)
* fix: Admin can see all private repositories on Explore page.

* refactor: fix session
2017-02-26 13:59:31 +08:00
Sandro Santilli
bf24099114 Allow migrating installations with no local avatars (#1056) 2017-02-26 11:58:02 +08:00
Lunny Xiao
80f900ebae Fix avatar enumable (#1049)
* fix avatar enumable

* fix import style
2017-02-25 22:58:57 +08:00
Lunny Xiao
19b3c45ca7 fix 500 when use a duplicat email instead of giving an error tip (#1040) 2017-02-25 22:57:06 +08:00
Lunny Xiao
cd1821a7e2 Move push update to post-receive and protected branch check to pre-receive (#1030)
* move all push update to git hook post-receive and protected branch check to git hook pre-receive

* add SSH_ORIGINAL_COMMAND check back

* remove all unused codes

* fix the import
2017-02-25 22:54:40 +08:00
Lunny Xiao
e8e56da9ac fix #13 (#1042) 2017-02-25 22:53:57 +08:00
Andrey Nering
ddb0287bf6 Merge pull request #970 from andreynering/api-repo-mirror
Add "mirror" field to repo API
2017-02-25 11:35:03 -03:00
Lunny Xiao
fc4f7e82f9 refactor for searching user (#1038)
* refactor for searching user

* fix like bug

* better format for builder cond
2017-02-25 21:42:20 +08:00
Andrey Nering
946f3078d3 Add "mirror" field to repo API 2017-02-25 10:04:22 -03:00
Bo-Yi Wu
f1412142e0 refactor: repo counts for SearchRepositoryByName func (#1045) 2017-02-25 09:27:39 +08:00
Lunny Xiao
c0ea3963be fix delete repo will hang on postgres (#1044) 2017-02-24 23:19:13 +08:00
Andrew Boyarshin
0602a44b27 Fix URL handling in the whole markdown module, improve test coverage (#1027)
Amended with string to bool change in API SDK.

Signed-off-by: Andrew Boyarshin <andrew.boyarshin@gmail.com>
2017-02-24 22:59:56 +08:00
Ethan Koenig
76057105ca Remove unnecessary loads in org_team (#1035) 2017-02-24 14:25:09 +08:00
Ethan Koenig
f1ab906c51 Unit tests for models/repo_collaboration (#1032) 2017-02-24 09:37:38 +08:00
bit
490d3771f7 s/fields/terms (#1031)
use terms instead of fields as variable name to avoid confusion: NewPhraseQuery(terms []string, field string)
2017-02-24 09:24:58 +08:00
Lunny Xiao
d077fd084a added missing new struct sync (#1021) 2017-02-23 15:05:37 +08:00
Lunny Xiao
0e6b9ea786 Take back control of hooks (#1006)
* git: delegate all server-side Git hooks (#1623)

* create hooks directories

* take control hooks back

* fix lint

* bug fixed and minor changes

* fix imports style

* fix migration scripts
2017-02-23 11:40:44 +08:00
Ethan Koenig
4f3880ff15 Bug fixes and unit tests for org_team (#1016) 2017-02-23 09:36:15 +08:00
Ethan Koenig
ec3a696e2d Fix lint errors 2017-02-22 17:10:45 -05:00
Lunny Xiao
1f7837d6d6 Refactor for issues loadattributes of a repository (#971)
* refactor for issues loadattributes of a repository

* refactors
2017-02-22 22:03:59 +08:00
Bo-Yi Wu
83b6d03231 fix: Wrong repo list on Explore page if user already loggin. (#1009)
* fix: Wrong repo list on Explore page if user already loggin.

* fix: code readable.

* fix: declare variable
2017-02-22 21:15:14 +08:00
Willem van Dreumel
01d957677f Oauth2 consumer (#679)
* initial stuff for oauth2 login, fails on:
* login button on the signIn page to start the OAuth2 flow and a callback for each provider
Only GitHub is implemented for now
* show login button only when the OAuth2 consumer is configured (and activated)
* create macaron group for oauth2 urls
* prevent net/http in modules (other then oauth2)
* use a new data sessions oauth2 folder for storing the oauth2 session data
* add missing 2FA when this is enabled on the user
* add password option for OAuth2 user , for use with git over http and login to the GUI
* add tip for registering a GitHub OAuth application
* at startup of Gitea register all configured providers and also on adding/deleting of new providers
* custom handling of errors in oauth2 request init + show better tip
* add ExternalLoginUser model and migration script to add it to database
* link a external account to an existing account (still need to handle wrong login and signup) and remove if user is removed
* remove the linked external account from the user his settings
* if user is unknown we allow him to register a new account or link it to some existing account
* sign up with button on signin page (als change OAuth2Provider structure so we can store basic stuff about providers)

* from gorilla/sessions docs:
"Important Note: If you aren't using gorilla/mux, you need to wrap your handlers with context.ClearHandler as or else you will leak memory!"
(we're using gorilla/sessions for storing oauth2 sessions)

* use updated goth lib that now supports getting the OAuth2 user if the AccessToken is still valid instead of re-authenticating (prevent flooding the OAuth2 provider)
2017-02-22 08:14:37 +01:00
Denis Denisov
fd941db246 Protected branches system (#339)
* Protected branches system

* Moved default branch to branches section (`:org/:reponame/settings/branches`).
* Initial support Protected Branch.
  - Admin does not restrict
  - Owner not to limit
  - To write permission restrictions

* reformat tmpl

* finished the UI and add/delete protected branch response

* remove unused comment

* indent all the template files and remove ru translations since we use crowdin

* fix the push bug
2017-02-21 23:02:10 +08:00
Willem van Dreumel
5f234ce2a5 add missing copyright header (#992) 2017-02-21 08:46:14 +08:00
Lunny Xiao
04fdeb9d8d Make Xorm log configurable (#174)
* make xorm log configable

* bug fixed for other sub commands except web

* rebase and fix xorm log

* bug fix for TrimSpace
2017-02-20 16:11:13 +08:00
Ethan Koenig
be48b32e63 Unit tests for repo watching (#963) 2017-02-17 16:02:11 +08:00
Lunny Xiao
847527fd6d Fix all the bugs in issues and pulls on dashboard (#943)
* fix all the bugs in issues and pulls on dashboard

* small fix and refactor

* add method getRepoIDs for IssueList
2017-02-17 08:58:19 +08:00
Ethan Koenig
140967f002 Unit tests for repo redirects (#961) 2017-02-17 08:55:33 +08:00
Lunny Xiao
7fd14bf7bd optimization for team get repos (#953) 2017-02-16 12:07:58 +08:00
Lunny Xiao
46320f9630 refactor notificationsForUser since xorm In support slice of customerize type (#956) 2017-02-16 12:07:00 +08:00
Lunny Xiao
0642cb330c Small opitimization for getUserTeams (#954)
* Small opitimization for getUserTeams

* more compact
2017-02-16 12:06:23 +08:00
Bo-Yi Wu
43c94d0a6c test: Add testing for GetUserFork function (#944) 2017-02-15 23:24:23 +08:00
Bo-Yi Wu
a31f64d639 fix: 500 error on /explore/repos page. (#946) 2017-02-15 22:28:11 +08:00
Bo-Yi Wu
9d2b830275 refactor: small optimize for sql query (#940)
* refactor: small optimize for sql query

* fix: get owner name if Searcher is not nil or user star page.
2017-02-15 14:01:50 +08:00
Lunny Xiao
837d346090 fix some older Gogs upgrade to Gitea (#929) 2017-02-15 09:32:03 +08:00
Lunny Xiao
9c645b54dc bug fixed on issues and pulls 2017-02-15 01:17:07 +01:00
Lunny Xiao
4cfde304df bug fixed for my repository (#933) 2017-02-14 23:37:44 +08:00
Lunny Xiao
7a9a5c8a69 Fix assigned issues dashboard (#920)
* Fix assigned/created issues in dashboard. (#3560)

* Fix assigned/created issues in dashboard.

* Use GetUserIssueStats for getting all Dashboard stats.

* Use gofmt to format the file properly.

* Replace &Issue{} with new(Issue).

* Check if user has access to given repository.

* Remove unnecessary filtering of issues.

* Return 404 error if invalid repository is given.

* Use correct number of issues in paginater.

* fix issues on dashboard
2017-02-14 22:15:18 +08:00
Lunny Xiao
3a91ac51a9 fix bug of multiple forks (#928) 2017-02-14 22:14:29 +08:00
Bo-Yi Wu
d67b278a0d feat: Able to disable non-admin to create new organization (#927) 2017-02-14 20:16:00 +08:00
Bo-Yi Wu
23aba523b5 feat: support search bar on star tab of user profile. (#917)
* feat: support search bar on star tab of user profile.

* fix: update testing.

* fix: Using loadAttributes

* fix: remove empty line.

* remove LOWER

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-02-14 15:28:22 +08:00
Lunny Xiao
7eb8daffa3 Use fingerprint to check instead content for public key (#911)
* use fingerprint to check instead content for public key

* add fingerprint field for ErrKeyAlreadyExist
2017-02-14 14:12:52 +08:00
Lunny Xiao
55ae78208e Small optimization for getTeamIDs (#919)
* small optimization for getTeamIDs

* rename getOrgTeamIDs to getUserTeamIDs and remove orderby
2017-02-14 11:46:46 +08:00
Bo-Yi Wu
1ec6b1a258 fix: gofmt error. (#918) 2017-02-14 10:12:03 +08:00
Bo-Yi Wu
5cc275b1de feat: add git version on admin panel. (#921) 2017-02-13 19:49:42 +08:00
Ethan Koenig
076f940f1f Fix logging bug
Error logged everytime an assignee was removed
2017-02-12 08:54:15 +01:00
Lunny Xiao
d76f34ef51 small optimization for get issue labels 2017-02-12 06:46:51 +01:00
Andrew
3f67676059 Implement basic Open Graph support. (#901) 2017-02-11 20:57:33 +08:00
Lunny Xiao
8a0be5e9f0 Bug fixed for deleted label in issue comment (#904)
* bug fixed for deleted label in issue comment

* fix indent
2017-02-11 20:56:57 +08:00
Morgan Bazalgette
442145dbd3 Fix public activity showing private repos (#892)
* Fix public activity showing private repos (#811)

Signed-off-by: Morgan Bazalgette <the@howl.moe>

* error check after setting is_private to true

* Add test for UpdateRepository w/ visibility change
2017-02-11 18:57:57 +08:00
Andrew
42835c7f82 Implement archive cleanup (#885)
* Implement archive cleanup

Fixes #769

Signed-off-by: Andrew <write@imaginarycode.com>

* Make sure to close the directory file

* Resolve issues noted by @strk

* edit cheatsheet app.ini [ci skip]

* oops [ci skip]
2017-02-11 12:00:46 +08:00
Lunny Xiao
cf0f451c37 Add delete branch track on pull request comments (#888)
* add delete branch track on pull request comments

* don't change vendor
2017-02-11 12:00:29 +08:00
Lunny Xiao
b6dd6210ea bug fixed for issue count (#881) 2017-02-09 17:59:57 +08:00
Ethan Koenig
a6751cec04 Unit tests for issue_milestone (#878) 2017-02-09 14:39:26 +08:00
Ethan Koenig
13973348df Gogs -> Gitea (#877) 2017-02-09 13:44:18 +08:00
Ethan Koenig
e6b4448ba3 Fix bug in Issue.GetIsRead (#876) 2017-02-09 11:47:24 +08:00
Ethan Koenig
181c8d9c99 Fix consistency check (#866) 2017-02-08 14:29:21 +08:00
Ethan Koenig
d2329e1c26 Use assert in legacy unit tests (#867) 2017-02-08 14:29:07 +08:00
Ethan Koenig
5fbab97373 Fix broken test fixture (#859) 2017-02-07 22:49:37 +08:00
Bo-Yi Wu
b13232f524 feat: support paginater on star tab of user profile. (#845) 2017-02-07 19:54:16 +08:00
Ethan Koenig
ceae143e78 Consistency checks for unit tests (#853) 2017-02-07 19:47:55 +08:00
Bo-Yi Wu
71d35dae8c fix: wrong pages number which includes private repository count. (#844) 2017-02-06 23:18:36 +08:00
Ethan Koenig
438e1a7d46 Fix inconsistencies in unit test fixtures 2017-02-05 22:43:31 -05:00
Lunny Xiao
f35b20b042 track issue title changes (#841) 2017-02-05 22:36:00 +08:00
Ethan Koenig
027591a3a5 Redirects for renamed repos (#807)
* Redirects for renamed repos

* Remove unused phrase from locales
2017-02-05 22:35:03 +08:00
Bwko
bf647ce143 Check for manual merging of a pull request (#719)
When an open pull request got manually merged mark the pull request as
merged
2017-02-05 21:07:44 +08:00
Andrey Nering
7c3dc51655 Merge pull request #839 from ethantkoenig/fix/remove_org_repo
Fix bug in removeOrgRepo
2017-02-04 14:55:02 -02:00
Ethan Koenig
f82ea42679 Fix bug in removeOrgRepo 2017-02-04 11:01:21 -05:00
Ethan Koenig
5972aa9af3 Fix inconsistencies in test fixtures 2017-02-04 11:01:06 -05:00
Lunny Xiao
8a421b1fd7 Add units concept for modulable functions of a repository (#742)
* Add units concept for modulable functions of a repository

* remove unused comment codes & fix lints and tests

* remove unused comment codes

* use struct config instead of map

* fix lint

* rm wrong files

* fix tests
2017-02-04 23:53:46 +08:00
Ethan Koenig
d0960b8035 Move IssueUser code to separate file (#836)
Also add unit tests
2017-02-04 20:37:26 +08:00
Andrey Nering
d4035d1cb1 Merge pull request #830 from appleboy/patch-2001
refactor: set default order by recently star on start tab
2017-02-04 10:32:55 -02:00
Bo-Yi Wu
a90a215662 feat: Add search bar on user profile page. (#787) 2017-02-04 20:20:20 +08:00
Bo-Yi Wu
b6da658553 test: Add user mail testing. (#833) 2017-02-04 09:20:56 +08:00
Lunny Xiao
3e0525b47d Track assignee for issue (#808)
* track assignee for issue

* fix lint

* use getUserByID instead Get
2017-02-03 23:09:10 +08:00
Ethan Koenig
68bdaf0a6b Drop redundant columns from issue_user table (#638) 2017-02-03 15:22:39 +08:00
Bo-Yi Wu
e2de16065a refactor: set default order by recently star. 2017-02-03 12:03:49 +08:00
Gabriel Jackson
bf6f61cc69 Cleanup log messaging
This change corrects a few logging issues:

 * Standardized formatting errors with '%v'.
 * Standardized failure warning word usage.
 * Corrected an instance of using the standard log library when
   the gitea log library should be used instead.
2017-02-02 15:24:18 +01:00
Bo-Yi Wu
d7d094bd8a fix: ignore email notifications if user is not active. (#820) 2017-02-02 20:33:36 +08:00
Anton Skorokhod
79ab69fe30 Add X-GitHub-* headers for webhook to get clubhouse.io integration working (#809) 2017-02-02 11:51:19 +08:00
Lunny Xiao
081485ecfd add milestone changed traker on issue view (#804) 2017-02-01 10:36:08 +08:00
Ethan Koenig
10644d6dd7 Bug fixes and unit tests for models/issue_label (#802) 2017-02-01 09:31:35 +08:00
Ethan Koenig
0a02fb3c4f Windows compatibility for unit tests (#800) 2017-01-30 22:22:04 +08:00
Ethan Koenig
2eb15f4a61 Unit tests and remove unused functions in models/notification (#796)
* Unit tests and remove unused functions in models/notification

* Read -> Unread
2017-01-30 22:21:49 +08:00
Lunny Xiao
f94869d2d1 Track labels changed on issue view & resolved #542 (#788)
* track labels changed on issue view & resolved #542

* add missing head comment & sort & fix refresh
2017-01-30 20:46:45 +08:00
Ethan Koenig
7765593018 Better settings for unit tests (#795) 2017-01-30 13:17:43 +08:00
Thomas Boerger
78535fb08e Allow custom public files (#782)
* Allow custom public files

* Gofmt code, lots of places not related to this pr
2017-01-28 23:14:56 +01:00
Andrey Nering
cc31a21192 Merge pull request #781 from andreynering/notifications-step-5
Notifications step 5
2017-01-28 17:54:37 -02:00
Andrey Nering
5348e8b71a Fix color: closed PR was showing as purple instead of red 2017-01-28 14:01:07 -02:00
Andrey Nering
31c717f579 Merge pull request #777 from ethantkoenig/tests/wiki
Unit tests for models/wiki
2017-01-28 11:27:45 -02:00
Ethan Koenig
bb76285762 Unit tests for models/wiki 2017-01-27 13:08:17 -05:00
Ethan Koenig
a2412492da Unit tests and bug fix for models/org 2017-01-27 12:24:06 -05:00
Lunny Xiao
bb5a6b7a07 fix xorm NewSession uncorrected usages (#774) 2017-01-28 00:11:41 +08:00
Bo-Yi Wu
25663b5816 refactor: Remove unnecessary type conversions (#772) 2017-01-27 23:03:32 +08:00
Ethan Koenig
da1b6164fe Fix FIXME and remove superfluous queries in models/org (#749) 2017-01-25 23:41:38 +08:00
Bo-Yi Wu
691fbdf1d3 fix: delete attachment after remove comment. 2017-01-25 16:40:43 +01:00
Ethan Koenig
0934d1b1ea Bug fixes and unit tests for models/webhook (#751) 2017-01-25 18:37:35 +08:00
Ethan Koenig
a6832c234d Unit tests for models/star (#752) 2017-01-25 18:37:10 +08:00
Lunny Xiao
8c2381103a bug fixed issues 500 resolved #754 (#756) 2017-01-25 16:28:03 +08:00
Ethan Koenig
8093b3372e Less boilerplate in models/ unit tests (#725) 2017-01-25 10:49:51 +08:00
Ethan Koenig
833f8b94c2 Search bar for issues/pulls (#530) 2017-01-25 10:43:02 +08:00
Andrey Nering
521d429b58 Fix link of some repos on stars page (#737)
Link was wrong the repo was of another owner
2017-01-24 10:39:58 +08:00
Bwko
74ed6dc3ad Add option to app.ini to enable local import paths (#724) 2017-01-23 09:19:50 +08:00
Bwko
1257d43e14 Add a reserved path check to the wiki (#720) 2017-01-22 23:08:54 +08:00
Lunny Xiao
f8c2903484 fixed bugs on Wiki and resolved #667 (#674) 2017-01-21 20:50:51 +08:00
Philip Couling
1610b9f547 Spun attachments into seperate go file (#701)
Moved attachments into seperate go file
2017-01-20 07:58:46 +01:00
Ethan Koenig
74bbec3bf9 Fix permission bugs in team API (#647) 2017-01-20 13:16:10 +08:00
Ethan Koenig
fcf02e4961 API Endpoints for organization members (#645) 2017-01-20 10:31:46 +08:00
Matthias Loibl
d1006150fb Refactor process package and introduce ProcessManager{} with tests (#75)
* Add a process.Manager singleton with process.GetManager()

* Use process.GetManager everywhere

* Fix godoc comments for process module

* Increment process counter id after locking the mutex
2017-01-17 13:58:58 +08:00
Andrew
6dd096b7f0 Two factor authentication support (#630)
* Initial commit for 2FA support

Signed-off-by: Andrew <write@imaginarycode.com>

* Add vendored files

* Add missing depends

* A few clean ups

* Added improvements, proper encryption

* Better encryption key

* Simplify "key" generation

* Make 2FA enrollment page more robust

* Fix typo

* Rename twofa/2FA to TwoFactor

* UNIQUE INDEX -> UNIQUE
2017-01-16 10:14:29 +08:00
Philip Couling
64375d875b Attach to release (#673)
* Moved attachaments POST url from /issues/attachments to /attachments

* Implemented attachment upload on release page

* Implemented downloading attachments on the release page

* Added zip and gzip files to default allowed attachments

* Implemented uploading attachments on edit release

* Renamed UploadIssueAttachment to UploadAttachment
2017-01-15 22:57:00 +08:00
btrepp
302fa42980 Removes reliance on server specific SQL (#393)
Breaks the retrieval of repositories into two queries
This fetches the paged ids in one go, then the
actual repository information in a second query

Some databases do not support SELECT with *
when group by is used.
2017-01-14 22:32:36 +08:00
Ethan Koenig
a6f5efa0bb Fix ambiguity bug in getCommentsByRepoIDSince (#665) 2017-01-14 10:21:30 +08:00
Ethan Koenig
27fcf8d30a Bug fixes for webhook API (#650) 2017-01-14 10:14:48 +08:00
Lunny Xiao
87ad4961f6 bug fixed for update repository (#664) 2017-01-14 10:07:04 +08:00
Andrey Nering
769e0a3ea6 Notifications: mark as read/unread and pin (#629)
* Use relative URLs

* Notifications - Mark as read/unread

* Feature of pinning a notification

* On view issue, do not mark as read a pinned notification
2017-01-12 12:27:09 +08:00
Bo-Yi Wu
cbf2a967c5 refactor: Add new deleteOrg func. (#633) 2017-01-11 21:10:43 +08:00
Ethan Koenig
b316b2e740 Unit tests for models/admin 2017-01-09 21:49:51 +01:00
Ethan Koenig
973282dae2 Better coverage in pull_test (#615) 2017-01-09 11:15:07 +08:00
Ethan Koenig
862948ab88 Better coverage and TODOs for update_test (#616) 2017-01-09 11:14:57 +08:00
Ethan Koenig
4b23e6a694 Unit tests for models/action (#619) 2017-01-09 11:08:36 +08:00
derSuessmann
51d578ff33 Add Keep email private (see issue #571). (#571)
- Add site-wide option DEFAULT_KEEP_EMAIL_PRIVATE.
- Add the new option to the install and admin/config pages.
- Add the new option to app.ini in the service section.
- Add the new option to the settings struct.
- Add English text strings to i18n.
- Add field KeepEmailPrivate to user struct.
- Add field KeepEmailPrivate to user form.
- Add option to UI.
- Add using noreply email address if user has "Keep Email Private".
An email address <LowerName>@<NO_REPLY_ADDRESS> is now used in commit
messages (and hopefully all other git log relevant places). The
change relies on the fact that git commands should use
user.NetGitSig().
- Add hiding of email address in UI, if user has set "Keep Email Private".
- Add condition to show email address only on explore/users and user
pages, if user has not set "Keep Email Private".
- Add noreply email in API if set "Keep Email Private".
- Add a new service setting NO_REPLY_ADDRESS. The value of this
setting is used as the domain part for the user's email address in
git log, iff he decides to keep his email address private.
If the user decides to keep his email address private and this
option is not set 'noreply.example.org' is used, which no MTA
should send email to.

Add NO_REPLY_ADDRESS to conf/app.ini.
2017-01-08 11:12:03 +08:00
Ethan Koenig
6072b03291 Unit tests for models/access.go (#606) 2017-01-08 11:10:53 +08:00
Ethan Koenig
8422ab542c API endpoint for subscribers (#598) 2017-01-07 11:13:02 +08:00
Andrey Nering
03b45284e1 Merge pull request #555 from ethantkoenig/tests/pull
Unit tests for models/pull.go
2017-01-06 19:19:18 -02:00
Andrey Nering
84b7d29d34 Create missing database indexes (#596) 2017-01-06 23:14:33 +08:00
Ethan Koenig
72bfabfada Unit tests for models/pull.go 2017-01-06 10:08:23 -05:00
Ethan Koenig
1a7fc53c98 API endpoint for stargazers (#597) 2017-01-06 15:05:09 +08:00
Lunny Xiao
61306fa737 Make releases faster than before and resolved #490 (#588)
* make releases faster than before and resolved #490

* fix comment
2017-01-06 09:51:15 +08:00
Andrey Nering
79d527195d Merge pull request #539 from andreynering/notifications-step-2
Notifications - Step 2
2017-01-05 11:53:01 -02:00
Ethan Koenig
c5f0d4b1a0 Fix SQL bug in models/access (#583)
Previously got a 'relation repo_access does not exist' error in User_GetRepositoryAccesses
2017-01-05 08:57:54 +08:00
Berk Demirkır
bdad3b259a Check primary email address fields on CreateUser (#556)
* Check primary email address fields on CreateUser

As this check wasn't available, uid=1 (and possibly guests too, if registration is open) is able to register new users with existing email addresses. This leads to numerous 500 errors.

* Update user.go

* Lower the email first. Then check
2017-01-05 08:52:20 +08:00
Ethan Koenig
1207bda94b Fix typos in models/ (#576) 2017-01-05 08:50:34 +08:00
Andrey Nering
b354cf362e Add pagination for notifications 2017-01-03 17:09:36 -02:00
Lunny Xiao
09dabe2ff2 fix bug #564 (#567) 2017-01-03 16:27:11 +08:00
Lunny Xiao
980dd0bf51 Update xorm and dependencies vendor for feature to dump to other database (#565)
* update xorm and dependencies vendor for feature to dump to other database

* fix golint
2017-01-03 16:20:28 +08:00
Kjell Kvinge
4b0974ec10 Fix benchmarktests (#557) 2017-01-03 10:52:09 +08:00
Lunny Xiao
3c7116382f change the default action when deleting a release to not delete tag 2017-01-03 02:27:38 +01:00
Ethan Koenig
0c301f7b5c Release API endpoints 2017-01-02 00:10:52 +01:00
Lunny Xiao
6e5fffbd3f resolved #485: when migrate empty wiki repo, then ignore (#541) 2016-12-31 17:34:34 +08:00
Ethan Koenig
de8b73dd92 Unit tests for token and update models 2016-12-31 10:17:45 +01:00
Schwobaland
c0904f1942 Restrict creating organisations by user (#193)
* restrict creating organizations based on right on user

* revert bindata.go

* reverse vendor lib

* revert goimports change

* set AllowCreateOrganization default value to true

* revert locale

* added default value for AllowCreateOrganization

* fix typo in migration-comment

* fix comment

* add coments in migration
2016-12-31 10:33:30 +08:00
Bo-Yi Wu
6510e57758 fix gofmt error
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-30 20:41:10 +01:00
Andrey Nering
42904cb98a Notification - Step 1 (#523)
* Notification - Step 1

* Add copyright headers

* Cache issue and repository on notification model
2016-12-31 00:44:54 +08:00
typeless
937b4b5aa1 Speed up conflict checking in pull request creation (#276)
* Speed up conflict checking in pull request creation

In order to check conflicts of a PR, we set up a working tree by
cloning the base branch, which is quite time-consuming when the repository is huge.
Instead, this PR uses `git read-tree` and `git apply --check --cached` to check conflicts.

For #258

* Use $GIT_INDEX_FILE instead of --index-output to avoid lockfile problem

The lockfile gets renamed to the final destination after the operation
finishes. But it must be located in the same filesystem, which prevents
us from using /tmp.

* Temporary file names should not prefixed with '-'
2016-12-29 22:59:52 +08:00
Andrey Nering
b992858883 Tab on user profile to show starred repos (#519)
* Tab on user profile to show starred repos

* Make golint happy and use transactions on StarRepo function

* x -> sess

* Use sess.Close() instead of sess.Rollback()

* Add copyright

* Fix lint
2016-12-29 22:58:24 +08:00
Lunny Xiao
799d0c2030 slight optimization for GetUserRepositories (#498) 2016-12-29 02:53:33 -06:00
Kjell Kvinge
22e1bd31c6 commithgraph / timeline (#428)
* Add model and tests for graph

* Add route and router for graph

* Add assets for graph

* Add template for graph
2016-12-29 07:44:32 +08:00
Bwko
331316894e Replace Gogs with Gitea (#520) 2016-12-28 16:33:21 +08:00
Lunny Xiao
c463b1b8cb Optimization for user.GetRepositoryAccesses to reduce db query times (#495)
* optimization for user.GetRepositoryAccesses to reduce db query times

* fix missing cache
2016-12-28 09:34:35 +08:00
Lunny Xiao
ba134bd27a fix 500 when delete orgnization and resolved #486 2016-12-27 12:00:12 +01:00
Ethan Koenig
2342df183b API Endpoints for collaborators (#375) 2016-12-26 15:37:01 +08:00
Fabian Zaremba
2e7ccecfe6 Git LFS support v2 (#122)
* Import github.com/git-lfs/lfs-test-server as lfs module base

Imported commit is 3968aac269a77b73924649b9412ae03f7ccd3198

Removed:

Dockerfile CONTRIBUTING.md mgmt* script/ vendor/ kvlogger.go
.dockerignore .gitignore README.md

* Remove config, add JWT support from github.com/mgit-at/lfs-test-server

Imported commit f0cdcc5a01599c5a955dc1bbf683bb4acecdba83

* Add LFS settings

* Add LFS meta object model

* Add LFS routes and initialization

* Import github.com/dgrijalva/jwt-go into vendor/

* Adapt LFS module: handlers, routing, meta store

* Move LFS routes to /user/repo/info/lfs/*

* Add request header checks to LFS BatchHandler / PostHandler

* Implement LFS basic authentication

* Rework JWT secret generation / load

* Implement LFS SSH token authentication with JWT

Specification: https://github.com/github/git-lfs/tree/master/docs/api

* Integrate LFS settings into install process

* Remove LFS objects when repository is deleted

Only removes objects from content store when deleted repo is the only
referencing repository

* Make LFS module stateless

Fixes bug where LFS would not work after installation without
restarting Gitea

* Change 500 'Internal Server Error' to 400 'Bad Request'

* Change sql query to xorm call

* Remove unneeded type from LFS module

* Change internal imports to code.gitea.io/gitea/

* Add Gitea authors copyright

* Change basic auth realm to "gitea-lfs"

* Add unique indexes to LFS model

* Use xorm count function in LFS check on repository delete

* Return io.ReadCloser from content store and close after usage

* Add LFS info to runWeb()

* Export LFS content store base path

* LFS file download from UI

* Work around git-lfs client issue with unauthenticated requests

Returning a dummy Authorization header for unauthenticated requests
lets git-lfs client skip asking for auth credentials
See: https://github.com/github/git-lfs/issues/1088

* Fix unauthenticated UI downloads from public repositories

* Authentication check order, Finish LFS file view logic

* Ignore LFS hooks if installed for current OS user

Fixes Gitea UI actions for repositories tracking LFS files.
Checks for minimum needed git version by parsing the semantic version
string.

* Hide LFS metafile diff from commit view, marking as binary

* Show LFS notice if file in commit view is tracked

* Add notbefore/nbf JWT claim

* Correct lint suggestions - comments for structs and functions

- Add comments to LFS model
- Function comment for GetRandomBytesAsBase64
- LFS server function comments and lint variable suggestion

* Move secret generation code out of conditional

Ensures no LFS code may run with an empty secret

* Do not hand out JWT tokens if LFS server support is disabled
2016-12-26 09:16:37 +08:00