aboutsummaryrefslogtreecommitdiffstats
path: root/models/action_test.go
Commit message (Collapse)AuthorAgeFilesLines
* GetFeeds must always discard actions with dangling repo_id (#19598)singuliere2022-05-051-0/+17
| | | | | | | | | | | | | | * GetFeeds must always discard actions with dangling repo_id See https://discourse.gitea.io/t/blank-page-after-login/5051/12 for a panic in 1.16.6. * add comment to explain the dangling ID in the fixture * loadRepoOwner must not attempt to use a nil action.Repo * make fmt Co-authored-by: Loïc Dachary <loic@dachary.org>
* RSS/Atom support for Repos (#19055)65432022-03-131-4/+46
| | | | | | | * support for repos * refactor * advertise the feeds via meta tags * allow feed suffix and feed header * optimize performance
* RSS/Atom support for Orgs (#17714)65432022-03-101-0/+40
| | | part of #569
* Some repository refactors (#17950)Lunny Xiao2021-12-121-0/+37
| | | | | | | | | * some repository refactors * remove unnecessary code * Fix test * Remove unnecessary banner
* Move repository model into models/repo (#17933)Lunny Xiao2021-12-101-2/+3
| | | | | | | | | | | | | | | * Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
* Move user related model into models/user (#17781)Lunny Xiao2021-11-241-5/+6
| | | | | | | | | | | | | * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
* Decouple unit test, remove intermediate `unittestbridge` package (#17662)wxiaoguang2021-11-161-8/+7
| | | Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Decouple unit test code from business code (#17623)wxiaoguang2021-11-121-4/+5
|
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-191-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL ↵zeripath2021-02-191-1/+1
| | | | | | | | (#12999) Also removes some unnecessary uses of fmt.Sprintf and adds documentation strings Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add gitea-vet (#10948)John Olheiser2020-04-051-0/+4
| | | | | | | | | | | | | | | | | * Add copyright Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add gitea-vet and fix non-compliance Signed-off-by: jolheiser <john.olheiser@gmail.com> * Combine tools.go into build.go and clean up Signed-off-by: jolheiser <john.olheiser@gmail.com> * Remove extra GO111MODULE=on Signed-off-by: jolheiser <john.olheiser@gmail.com>
* Restricted users (#6274)Manush Dodunekov2020-01-131-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Restricted users (#4334): initial implementation * Add User.IsRestricted & UI to edit it * Pass user object instead of user id to places where IsRestricted flag matters * Restricted users: maintain access rows for all referenced repos (incl public) * Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses * Add basic repo access tests for restricted users Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Mention restricted users in the faq Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Remove unnecessary `org.IsOrganization()` call Signed-off-by: Manush Dodunekov <manush@stendahls.se> * Revert to an `int64` keyed `accessMap` * Add type `userAccess` * Add convenience func updateUserAccess() * Turn accessMap into a `map[int64]userAccess` Signed-off-by: Manush Dodunekov <manush@stendahls.se> * or even better: `map[int64]*userAccess` * updateUserAccess(): use tighter syntax as suggested by lafriks * even tighter * Avoid extra loop * Don't disclose limited orgs to unauthenticated users * Don't assume block only applies to orgs * Use an array of `VisibleType` for filtering * fix yet another thinko * Ok - no need for u * Revert "Ok - no need for u" This reverts commit 5c3e886aabd5acd997a3b35687d322439732c200. Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Move push commits from models to modules/repository (#9370)Lunny Xiao2020-01-101-100/+0
| | | | | | | | | | | | | | | | * Move push commits from models to modules/repository * fix test * fix test * fix test * fix test * fix test Co-authored-by: zeripath <art27@cantab.net>
* Move UpdateIssuesCommit from models to repofiles (#9276)Lunny Xiao2019-12-071-205/+0
|
* Fix permission checks for close/reopen from commit (#8875)guillep2k2019-11-151-2/+2
| | | | | * Fix checks for close/reopen from commit * Fix permission order
* Move transfer repository and rename repository on a service package and ↵Lunny Xiao2019-11-151-48/+0
| | | | | | | | | | | | | | | | | | | | | | start action notification (#8573) * move transfer repository and rename repository on a service package and start action notification * remove unused codes * fix lint * fix bugs * fix test * fix test * fix test * fix lint * update go mod and sum
* Move some actions to notification/action (#8779)Lunny Xiao2019-11-081-53/+0
| | | | | | | | * Move some actions to notification/action * Fix test * fix test
* Rewrite reference processing code in preparation for opening/closing from ↵guillep2k2019-10-131-52/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | comment references (#8261) * Add a markdown stripper for mentions and xrefs * Improve comments * Small code simplification * Move reference code to modules/references * Fix typo * Make MarkdownStripper return [][]byte * Implement preliminary keywords parsing * Add FIXME comment * Fix comment * make fmt * Fix permissions check * Fix text assumptions * Fix imports * Fix lint, fmt * Fix unused import * Add missing export comment * Bypass revive on implemented interface * Move mdstripper into its own package * Support alphanumeric patterns * Refactor FindAllMentions * Move mentions test to references * Parse mentions from reference package * Refactor code to implement renderizable references * Fix typo * Move patterns and tests to the references package * Fix nil reference * Preliminary rendering attempt of closing keywords * Normalize names, comments, general tidy-up * Add CSS style for action keywords * Fix permission for admin and owner * Fix golangci-lint * Fix golangci-lint
* Alwaywas return local url for users avatar (#8245)Sandro Santilli2019-09-261-1/+1
| | | | | | | | | | | * Always return local url for users avatar Avoids having to wait for DNS lookups when libravatar is activated fixing #6046 * Avoid double slash in avatar link * Move avatar route to the correct place
* feat: highlight issue references with : (#8101)Rinat2019-09-051-0/+1
| | | | | | | | | | | * feat: highlight issue references with : e.g. #1287: my commit msg e.g. ABC-1234: my commit msg * ref: update model regex to consistent with issueNumericPattern * test: check highlight issue with : in commits messages
* Add file status on API (#7671)Lunny Xiao2019-08-211-27/+54
| | | | | | | | | | * add file status on API * fix tests * fix tests * fix tests
* Move commit repo action from models to repofiles package (#7645)Lunny Xiao2019-07-301-114/+0
| | | | | | * move commit repo action from models to repofiles package * fix unit tests
* Fix regex for issues in commit messages (#7444)mrsdizzie2019-07-141-0/+19
| | | | | | | | | | * Fix regex for issues in commit messages Use same regex as markup for matching in commits. Fixes #7438 * make fmt
* Allow colon between fixing word and issue (#7207)zeripath2019-06-151-0/+26
| | | | | | * Allow colon between fixing word and issue * update test
* Improve issue reference on commit (#6694)mrsdizzie2019-05-011-0/+70
| | | | | | | | | | | | | | * Improve issue reference on commit Allow commits to properly reference issues in other repositories and also to close/reopen those issues if user has code permission. Should match Github behavior described here: https://help.github.com/en/articles/closing-issues-using-keywords Fixes 6664 * Fix missing return * Match user/repo directly in regex
* move code.gitea.io/git to code.gitea.io/gitea/modules/git (#6364)Lunny Xiao2019-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * move code.gitea.io/git to code.gitea.io/gitea/modules/git * fix imports * fix fmt * fix misspell * remove wrong tests data * fix unit tests * fix tests * fix tests * fix tests * fix tests * fix tests * enable Debug to trace the failure tests * fix tests * fix tests * fix tests * fix tests * fix tests * comment commit count tests since git clone depth is 50 * fix tests * update from code.gitea.io/git * revert change to makefile
* Add option to close issues via commit on a non master branch (#5992)Lanre Adelowo2019-02-101-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fixes #5957 * add tests to make sure config option is respected * use already defined struct * - use migration to make the flag repo wide not for the entire gitea instance Also note that the config value can still be set so as to be able to control the value for new repositories that are to be created - fix copy/paste error in copyright header year and rearrange import - use repo config instead of server config value to determine if a commit should close an issue - update testsuite * use global config only when creating a new repository * allow repo admin toggle feature via UI * fix typo and improve testcase * fix fixtures * add DEFAULT prefix to config value * fix test
* Don't close issues via commits on non-default branch. (#5622)Harshit Bansal2019-01-041-1/+28
| | | | | | | | Adds a small check to close the issues only if the referencing commits are on the default branch. Fixes: #2314.
* fix: Add feed for organization (#3594)Bo-Yi Wu2018-03-031-0/+1
| | | | | | | | | | | | * feat: Add feed for organization * fix: testing * fix: testing * fix: testing * fix: testing
* Remove IsOwner, NumTeams from OrgUser (#3269)Ethan Koenig2018-01-081-1/+1
|
* Fix ref parsing in commit messages (#3067)Ethan Koenig2017-12-031-0/+30
|
* Unit tests for wiki routers (#3022)Ethan Koenig2017-11-301-1/+1
|
* Use identicon image for default gravatar. (#2767)harry2017-10-231-2/+2
| | | | | | * Use identicon image for default gravatar. * Fixed tests.
* Replace deprecated Id method with ID (#2655)Ethan Koenig2017-10-051-2/+2
|
* Complete push webhooks (#2530)David Schneiderbauer2017-09-211-41/+103
| | | | | | | | | | | | | | | | | * implemented missing 'delete' push webhooks moreover created ActionDeleteBranch and ActionDeleteTag * add CommitRepoAction tests for tag/branch creation/deletion * fixed error where push webhook not called if is new branch or tag removed unnecessary code * moved prepare unit test environment into separate method to be used across unit tests * add missing if clause in pushUpdate Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
* Fix tests code to prevent some runtime errors (#2381)Morlinest2017-08-281-21/+25
| | | | | | * Fix tests code to prevent some runtime errors * Reduce nesting
* Ignore invalid issue numbers in commit messages. Fixes #2022 (#2150)Lauris BH2017-07-121-1/+1
|
* Fix "Dashboard shows deleted comments" (#1995)Jonas Franz2017-06-251-0/+3
|
* Fix user profile activity feed (#1848)Ethan Koenig2017-06-021-12/+33
| | | | | | * Fix user profile activity feed * gofmt, and avoid overlapping database connections
* Fix activity feed (#1779)Ethan Koenig2017-05-261-48/+44
| | | | | | | | | | | | * Fix activity feed Preserve actions after user/repo name change * Add missing comment * Fix migration, and remove fields completely * Tests
* Consistency checks for action unit tests (#1079)Ethan Koenig2017-02-281-3/+16
|
* Less boilerplate in models/ unit tests (#725)Ethan Koenig2017-01-251-32/+16
|
* Unit tests for models/action (#619)Ethan Koenig2017-01-091-0/+340