aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/notify
Commit message (Collapse)AuthorAgeFilesLines
* Clean up log messages (#30313)wxiaoguang2024-04-071-2/+0
| | | | | | `log.Xxx("%v")` is not ideal, this PR adds necessary context messages. Remove some unnecessary logs. Co-authored-by: Giteabot <teabot@gitea.io>
* Move context from modules to services (#29440)Lunny Xiao2024-02-274-4/+4
| | | | | | | | | | | | | | | Since `modules/context` has to depend on `models` and many other packages, it should be moved from `modules/context` to `services/context` according to design principles. There is no logic code change on this PR, only move packages. - Move `code.gitea.io/gitea/modules/context` to `code.gitea.io/gitea/services/context` - Move `code.gitea.io/gitea/modules/contexttest` to `code.gitea.io/gitea/services/contexttest` because of depending on context - Move `code.gitea.io/gitea/modules/upload` to `code.gitea.io/gitea/services/context/upload` because of depending on context
* Use db.Find instead of writing methods for every object (#28084)Lunny Xiao2023-11-243-9/+22
| | | | For those simple objects, it's unnecessary to write the find and count methods again and again.
* More `db.DefaultContext` refactor (#27265)JakobDev2023-09-293-6/+6
| | | | | | | Part of #27065 This PR touches functions used in templates. As templates are not static typed, errors are harder to find, but I hope I catch it all. I think some tests from other persons do not hurt.
* Fix bugs related to notification endpoints (#25548)Zettat1232023-06-282-2/+2
|
* Decouple the different contexts from each other (#24786)wxiaoguang2023-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | Replace #16455 Close #21803 Mixing different Gitea contexts together causes some problems: 1. Unable to respond proper content when error occurs, eg: Web should respond HTML while API should respond JSON 2. Unclear dependency, eg: it's unclear when Context is used in APIContext, which fields should be initialized, which methods are necessary. To make things clear, this PR introduces a Base context, it only provides basic Req/Resp/Data features. This PR mainly moves code. There are still many legacy problems and TODOs in code, leave unrelated changes to future PRs.
* Move `convert` package to services (#22264)KN4CK3R2022-12-293-3/+3
| | | | | | | | | | Addition to #22256 The `convert` package relies heavily on different models which is [disallowed by our definition of modules](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#design-guideline). This helps to prevent possible import cycles. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Implement FSFE REUSE for golang files (#21840)flynnnnnnnnnn2022-11-274-8/+4
| | | | | | | | | Change all license headers to comply with REUSE specification. Fix #16132 Co-authored-by: flynnnnnnnnnn <flynnnnnnnnnn@github> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Add `context.Context` to more methods (#21546)KN4CK3R2022-11-193-12/+12
| | | | | | | This PR adds a context parameter to a bunch of methods. Some helper `xxxCtx()` methods got replaced with the normal name now. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move some files into models' sub packages (#20262)Lunny Xiao2022-08-254-34/+34
| | | | | | | | | | | | | | | | | | | | | | | | | * Move some files into models' sub packages * Move functions * merge main branch * Fix check * fix check * Fix some tests * Fix lint * Fix lint * Revert lint changes * Fix error comments * Fix lint Co-authored-by: 6543 <6543@obermui.de>
* Add more linters to improve code readability (#19989)Wim2022-06-201-1/+1
| | | | | | | | | | Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability - nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length. - unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions - wastedassign - https://github.com/sanposhiho/wastedassign - wastedassign finds wasted assignment statements. - notlintlint - Reports ill-formed or insufficient nolint directives - stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent - excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005)
* Move issues related files into models/issues (#19931)Lunny Xiao2022-06-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Move access and repo permission to models/perm/access * fix test * fix git test * Move functions sequence * Some improvements per @KN4CK3R and @delvh * Move issues related code to models/issues * Move some issues related sub package * Merge * Fix test * Fix test * Fix test * Fix test * Rename some files
* Move almost all functions' parameter db.Engine to context.Context (#19748)Lunny Xiao2022-05-203-5/+5
| | | | * Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
* Delete related PullAutoMerge and ReviewState on User/Repo Deletion (#19649)65432022-05-081-1/+2
| | | | | | * delete pullautomerges on repo/user deletion * delete reviewstates on repo/user deletion * optimize automerhe code * add index to reviewstate
* Fix sending empty notifications (#19589)Gusted2022-05-021-1/+1
| | | - Don't send empty notifications on read notifications API.
* Never use /api/v1 from Gitea UI Pages (#19318)Lunny Xiao2022-04-071-1/+1
| | | | | | | | | | | | | Reusing `/api/v1` from Gitea UI Pages have pros and cons. Pros: 1) Less code copy Cons: 1) API/v1 have to support shared session with page requests. 2) You need to consider for each other when you want to change something about api/v1 or page. This PR moves all dependencies to API/v1 from UI Pages. Partially replace #16052
* Renamed ctx.User to ctx.Doer. (#19161)KN4CK3R2022-03-224-8/+8
| | | | Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* ignore missing comment for user notifications (#18954)eladyn2022-03-031-1/+1
| | | | | | | | | | * ignore missing comment for user notifications * instead fix bug in notifications model * use local variable instead Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Simplify parameter types (#18006)Gusted2021-12-201-1/+1
| | | Remove repeated type declarations in function definitions.
* Fix 500 when a comment was deleted which has a notification (#17550)Lunny Xiao2021-11-102-3/+3
| | | | | | | | | | * Fix 500 when a comment was deleted which has a notification * Tolerate missing Comment in other places too Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Notifications API: respond with updated notifications (#17064)Norwin2021-09-173-12/+23
| | | | | | | | | * notifications api: return updated notifications in response * make generate-swagger * openapi fix Co-authored-by: zeripath <art27@cantab.net>
* [API] generalize list header (#16551)65432021-08-122-0/+15
| | | | | | | | | | | | | * Add info about list endpoints to CONTRIBUTING.md * Let all list endpoints return X-Total-Count header * Add TODOs for GetCombinedCommitStatusByRef * Fix models/issue_stopwatch.go * Rrefactor models.ListDeployKeys * Introduce helper func and use them for SetLinkHeader related func
* Related refactors to ctx.FormX functions (#16567)65432021-08-112-3/+2
| | | | | | | * use FormTrim if posible * speedup goGet * only convert if nessesary
* Rename ctx.Form() to ctx.FormString() and move code into own file (#16571)65432021-08-113-5/+5
| | | | | | | Followup from #16562 prepare for #16567 * Rename ctx.Form() to ctx.FormString() * Reimplement FormX func to need less code and cpu cycles * Move code into own file
* Rename context.Query to context.Form (#16562)Lunny Xiao2021-07-294-12/+12
|
* [API] expose repo.GetReviewers() & repo.GetAssignees() (#16168)65432021-06-172-2/+2
| | | | | | | * API: expose repo.GetReviewers() & repo.GetAssignees() * Add tests * fix unrelated swagger query type
* Add subject-type filter to list notification API endpoints (#16177)65432021-06-163-41/+67
| | | Close #15886
* move notification APIFormat (#13783)65432020-12-023-3/+6
|
* API: Fix GetQueryBeforeSince (#13559)65432020-11-142-2/+2
|
* Extend Notifications API and return pinned notifications by default (#12164)zeripath2020-07-123-14/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Extend notifications API and return pinned notifications in notifications list Signed-off-by: Andrew Thornton <art27@cantab.net> * fix swagger Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix swagger again Signed-off-by: Andrew Thornton <art27@cantab.net> * fix test Signed-off-by: Andrew Thornton <art27@cantab.net> * remove spurious debugs * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Update models/notification.go * as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Remove page size limit comment from swagger (#11806)Cirno the Strongest2020-06-092-2/+2
| | | Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* [Api] Check Notify (always return json) (#10059)65432020-04-101-11/+2
| | | | | | | * BEAKING: check return status based on struct not httpStatus * update Tests * CI.restart()
* API add/generalize pagination (#9452)SpaWn2KiLl2020-01-242-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * paginate results * fixed deadlock * prevented breaking change * updated swagger * go fmt * fixed find topic * go mod tidy * go mod vendor with go1.13.5 * fixed repo find topics * fixed unit test * added Limit method to Engine struct; use engine variable when provided; fixed gitignore * use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors * set Page value on Home route * improved memory allocations * fixed response headers * removed logfiles * fixed import order * import order * improved swagger * added function to get models.ListOptions from context * removed pagesize diff on unit test * fixed imports * removed unnecessary struct field * fixed go fmt * scoped PR * code improvements * code improvements * go mod tidy * fixed import order * fixed commit statuses session * fixed files headers * fixed headers; added pagination for notifications * go mod tidy * go fmt * removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list * Apply suggestions from code review Co-Authored-By: 6543 <6543@obermui.de> Co-Authored-By: zeripath <art27@cantab.net> * fixed build error * CI.restart() * fixed merge conflicts resolve * fixed conflicts resolve * improved FindTrackedTimesOptions.ToOptions() method * added backwards compatibility on ListReleases request; fixed issue tracked time ToSession * fixed build error; fixed swagger template * fixed swagger template * fixed ListReleases backwards compatibility * added page to user search route Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
* [API] add endpoint to check notifications [Extend #9488] (#9595)65432020-01-141-0/+33
| | | | | | | | | | | | | | * introduce GET /notifications/new * add TEST * use Sprintf instead of path.Join * Error more verbose * return number of notifications if unreaded exist * 200 http status for available notifications
* [API] Add notification endpoint (#9488)65432020-01-093-0/+381
* [API] Add notification endpoints * add func GetNotifications(opts FindNotificationOptions) * add func (n *Notification) APIFormat() * add func (nl NotificationList) APIFormat() * add func (n *Notification) APIURL() * add func (nl NotificationList) APIFormat() * add LoadAttributes functions (loadRepo, loadIssue, loadComment, loadUser) * add func (c *Comment) APIURL() * add func (issue *Issue) GetLastComment() * add endpoint GET /notifications * add endpoint PUT /notifications * add endpoint GET /repos/{owner}/{repo}/notifications * add endpoint PUT /repos/{owner}/{repo}/notifications * add endpoint GET /notifications/threads/{id} * add endpoint PATCH /notifications/threads/{id} * Add TEST * code format * code format