Commit Graph

112 Commits (3d91bb2f2dc8584b76a49a1a40c3f688c21380f5)

Author SHA1 Message Date
Lanre Adelowo 57a69ef277 don't allow pull requests to be created on an archived repository ()
* don't allow pull requests to be created on an archived repository
Also disable the "PR" button if the repo is archived

* Refuse creating an issue/PR via API calls too
zeripath bf47f70c3b
API: Fix null pointer in attempt to Sudo if not logged in ()
Signed-off-by: Andrew Thornton <art27@cantab.net>
Shashvat Kedia 1b90692844 New API routes added ()
* New API routes added

* Comments added

* Build fix

* swagger_v1_json.tmpl without new line character

* Typo fix

* Code review changes

* Code review changes

* Add copyright

* Add copyright

* Add copyright

* Update per @lafriks feedback

* Update org.go

* Update user.go

* Update user.go

* make fmt
Harshit Bansal 5ac6da3c41 api: Add missing GET teams endpoints ()
* api: Add an endpoint to list a particular member of team.

* models: Rename `GetUserTeams()` to `GetUserOrgTeams()` in `org_team` model.

`GetUserTeams()` sounds a bit misnomer since it actually returns
the teams that user belongs to in a given organization rather than
all the teams across all the organization that the user has joined.

* models: Add `GetUserTeams()`.

Returns all the teams that a user belongs to.

* api: Add an endpoint for GET '/user/teams'.

A GET request to this endpoint lists all the teams that a user
belongs to.
Shashvat Kedia 6e20b504b1 Delete organization endpoint added ()
* Delete organization endpoint added

* Parameters added in comment

* Typo fix

* Newline character removed
Kasi Reddy d5d847e5c4 Git-Trees API ()
* Git-Trees API

* update vendor'd libs

* added comments to exported function and formatted.

* make fmt

* update per @lafirks feedback
Lunny Xiao eabbddcd98
Restrict permission check on repositories and fix some problems ()
* fix units permission problems

* fix some bugs and merge LoadUnits to repoAssignment

* refactor permission struct and add some copyright heads

* remove unused codes

* fix routes units check

* improve permission check

* add unit tests for permission

* fix typo

* fix tests

* fix some routes

* fix api permission check

* improve permission check

* fix some permission check

* fix tests

* fix tests

* improve some permission check

* fix some permission check

* refactor AccessLevel

* fix bug

* fix tests

* fix tests

* fix tests

* fix AccessLevel

* rename CanAccess

* fix tests

* fix comment

* fix bug

* add missing unit for test repos

* fix bug

* rename some functions

* fix routes check
Lauris BH 08bf443016 Implement git refs API for listing references (branches, tags and other) ()
* Inital routes to git refs api

* Git refs API implementation

* Update swagger

* Fix copyright

* Make swagger happy add basic test

* Fix test

* Fix test again :)
Lunny Xiao 8ef177f8c5 add api for user to create org ()
* add api for user to create org

* remove unused blank line on the swagger file end

* fix create and add test

* fix tests

* fix routes of create org API

* fix bug

* add copyright heads
zeripath 7096085f2b Fix by adding CSRF checking to api reqToken and add CSRF to the POST header for deadline ()
* Add CSRF checking to reqToken and place CSRF in the post for deadline creation

Fixes , 

* /api/v1/admin/users routes should have reqToken middleware
kolaente 6759237eda User action heatmap ()
* Added basic heatmap data

* Added extra case for sqlite

* Built basic heatmap into user profile

* Get contribution data from api & styling

* Fixed lint & added extra group by statements for all database types

* generated swagger spec

* generated swagger spec

* generated swagger spec

* fixed swagger spec

* fmt

* Added tests

* Added setting to enable/disable user heatmap

* Added locale for loading text

* Removed UseTiDB

* Updated librejs & moment.js

* Fixed import order

* Fixed heatmap in postgresql

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

Co-Authored-By: kolaente <konrad@kola-entertainments.de>

* Added copyright header

* Fixed a bug to show the heatmap for the actual user instead of the currently logged in

* Added integration test for heatmaps

* Added a heatmap on the dashboard

* Fixed timestamp parsing

* Hide heatmap on mobile

* optimized postgresql group by query

* Improved sqlite group by statement
Oleg Kovalov 5a4648cdd6 Remove check for negative length ()
B-OnTheGo e47df0b301 Enforce token on api routes [fixed critical security issue ] ()
zeripath d293a2b9d6 Add sudo functionality to the API ()
Lunny Xiao e48df3ee47 issues api allow pulls and fix ()
Piotr Orzechowski a74426d631 Swagger.v1.json template ()
* Turn swagger.v1.json into template

* Rename ENABLE_SWAGGER_ENDPOINT option to ENABLE_SWAGGER
kolaente ef6813abc9 Issue due date api ()
* Implemented basic api endpoint to manage deadlines

* Fixed checking for permissions

* Updating a deadline from the ui is now entirely done via the api

* cleanup

* Cosmetics

* fixed lint + fmt

* Added swagger model definition for deadline response

* Updated gitea-sdk

* Updated gitea-sdk

* More cleanup

* Generate swagger json

* Merge branch 'master' of https://github.com/go-gitea/gitea into issue-due-date-api

# Conflicts:
#	public/swagger.v1.json

* Fixed permission to update a deadline via api

* Re-added form to change a deadline

* Added client-side validation + not ignore error messages from the api

* Added locale for error message

* Merge branch 'master' of https://github.com/go-gitea/gitea

# Conflicts:
#	models/issue_comment.go

* Proper date validation

* Fixed indention

* moved css to css file

* added documentation for error codes

* after merge cleanup

* Added swagger description

* DO NOTHING BUT TRIGGER THAT F*CKIN CI SO IT PICKS UP THE LATEST COMMIT AS IT SHOULD

* DO NOTHING BUT TRIGGER THAT F*CKIN CI SO IT PICKS UP THE LATEST COMMIT AS IT SHOULD

* regenerated stylesheets
techknowlogick ab55ca7ebd
Add ability to delete a token ()
Fix 
Antoine GIRARD 6efdcaed86 Fix swagger security parts ()
Ethan Koenig 7ea4bfc561 API endpoint for testing webhook ()
* API endpoint for testing webhook

* Empty commit to rerun CI
Lunny Xiao bec69f702b
Add topic support ()
* 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
Jonas Franz 9a5e628a7e Add Attachment API ()
* 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
Piotr Orzechowski b104ab3ca1 Add option to enable or disable swagger endpoints ()
Marc Brückner 695b10bedd Fix API-Endpoint release ()
* Fixes API-Endpoint release ()

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

* Add release create, get and update test
Lauris BH 8ac1501ad7
Add Pull Request merge options - Ignore white-space for conflict checking, Rebase, Squash merge ()
* 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
Ethan Koenig 515cdaa85d Fix ignored errors when checking if organization, team member ()
Vlad Temian 469ab99e9a Delete a user's public key via admin api (closes ) ()
* 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
Ethan Koenig c3b6383b3a Fix comment API paths ()
Ethan Koenig f26f4a7e01 Update swagger documentation ()
* Update swagger documentation

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

* Restore delete comments
Lauris BH 08b124dd47
Fix API raw requests for commits and tags ()
Ethan Koenig 513375c429 Make URL scheme unambiguous ()
* 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
Antoine GIRARD 619b9b5547 Move swagger-ui under /api/v1 ()
* Move swagger interface under /api/v1

* Update swagger-ui

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

* Update test links

* Fix footer link
Jonas Franz 5ccecb44ad Feature: Timetracking ()
* 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  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 
* 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 
* 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>
Antoine GIRARD fd8e8a421a Improve swagger doc ()
* 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
Ethan Koenig f29458bd3a EnableUnit() -> UnitEnabled() ()
Lunny Xiao 04c4028aea
fix some bug
Aaron Walker 6a3c03762a API: support '/orgs/:org/repos' ()
* API: support '/orgs/:org/repos'
Ethan Koenig 93a1de4842 Fix repo API bug ()
Don't require token when not necessary
Antoine GIRARD 30787e48f2 Improve org error handling ()
* Improve ErrOrgNotExist type
Return new error type
Use good error check
Use new method to check error
Update tests

* Fix unchanged method name report
Ethan Koenig f99489d5c5 Fix API for branches with slashes ()
Antoine GIRARD 2bcd9471c9 Separate generate swagger + fix sed os specific ()
* 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
Andrey Nering 65cf6cc848 Merge pull request from ethantkoenig/fix/org_api_auth
Require token before checking membership/ownership
Ethan Koenig 971e3a35c1 Require token before checking membership/ownership
camlafit 952cb8046f A missing / to provide a correct endpoint
solve 
Antoine GIRARD 976c2a05fa Fix change introduce by update of go-swagger. ()
Ethan Koenig 7e6ff69c00 Fix 500 for GET /teams/:id endpoints ()
* Fix 500 for GET /teams/:id endpoints

* Integration test for GET /team/:id

* Clean up integration test
Antoine GIRARD 3edb0c5894 Generate swagger json ()
- 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
Kim "BKC" Carlbäcker 4bea219128 Status-API ()
Jonas f995bcc87a Add repo mirror sync API endpoint ()
* API: Add repo mirror sync

* Correct error message

* Change http status to 200
Antoine GIRARD ca1c3f1926 Implement GPG api ()
* Implement GPG API

* Better handle error

* Apply review recommendation + simplify database operations

* Remove useless comments