KN4CK3R
b2369830bb
Do not allow Ghost access to limited visible user/org ( #21849 ) ( #21876 )
...
Backport of #21849
2 years ago
delvh
0ebb45cfe7
Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) ( #21551 )
...
Found using
`find . -type f -name '*.go' -print -exec vim {} -c
':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;`
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago
KN4CK3R
c3b2e44392
Add team member invite by email ( #20307 )
...
Allows to add (not registered) team members by email.
related #5353
Invite by mail:
![grafik](https://user-images.githubusercontent.com/1666336/178154779-adcc547f-c0b7-4a2a-a131-4e41a3d9d3ad.png )
Pending invitations:
![grafik](https://user-images.githubusercontent.com/1666336/178154882-9d739bb8-2b04-46c1-a025-c1f4be26af98.png )
Email:
![grafik](https://user-images.githubusercontent.com/1666336/178164716-f2f90893-7ba6-4a5e-a3db-42538a660258.png )
Join form:
![grafik](https://user-images.githubusercontent.com/1666336/178154840-aaab983a-d922-4414-b01a-9b1a19c5cef7.png )
Co-authored-by: Jack Hay <jjphay@gmail.com>
2 years ago
zeripath
716fcfcf72
Make every not exist error unwrappable to a fs.ErrNotExist ( #20891 )
...
A lot of our code is repeatedly testing if individual errors are
specific types of Not Exist errors. This is repetitative and unnecesary.
`Unwrap() error` provides a common way of labelling an error as a
NotExist error and we can/should use this.
This PR has chosen to use the common `io/fs` errors e.g.
`fs.ErrNotExist` for our errors. This is in some ways not completely
correct as these are not filesystem errors but it seems like a
reasonable thing to do and would allow us to simplify a lot of our code
to `errors.Is(err, fs.ErrNotExist)` instead of
`package.IsErr...NotExist(err)`
I am open to suggestions to use a different base error - perhaps
`models/db.ErrNotExist` if that would be felt to be better.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
2 years ago
6543
c5e88fb03d
[API] teamSearch show teams with no members if user is admin ( #21204 )
...
close #21176
2 years ago
Lunny Xiao
1d8543e7db
Move some files into models' sub packages ( #20262 )
...
* 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>
2 years ago
Gusted
0b4c166e8a
Fix SQL Query for `SearchTeam` ( #20844 )
...
- Currently the function takes in the `UserID` option, but isn't being
used within the SQL query. This patch fixes that by checking that only
teams are being returned that the user belongs to.
Fix #20829
Co-authored-by: delvh <dev.lh@web.de>
2 years ago
Lunny Xiao
86c85c19b6
Refactor AssertExistsAndLoadBean to use generics ( #20797 )
...
* Refactor AssertExistsAndLoadBean to use generics
* Fix tests
Co-authored-by: zeripath <art27@cantab.net>
2 years ago
Tyrone Yeh
931c02d152
Add order by for assignee no sort issue ( #20053 )
...
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago
luzpaz
d29d6d1991
Fix various typos ( #20338 )
...
* Fix various typos
Found via `codespell -q 3 -S ./options/locale,./options/license,./public/vendor -L actived,allways,attachements,ba,befores,commiter,pullrequest,pullrequests,readby,splitted,te,unknwon`
Co-authored-by: zeripath <art27@cantab.net>
2 years ago
Lunny Xiao
0649c54275
Adjust transaction handling via db.Context ( #20031 )
2 years ago
Wim
cb50375e2b
Add more linters to improve code readability ( #19989 )
...
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 )
2 years ago
Lunny Xiao
d91d4db344
Move tests as seperate sub packages to reduce duplicated file names ( #19951 )
2 years ago
Lunny Xiao
fd7d83ace6
Move almost all functions' parameter db.Engine to context.Context ( #19748 )
...
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
3 years ago
Lunny Xiao
d81e31ad78
Move org functions ( #19753 )
...
* Move org functions
* Fix comment
3 years ago
zuzuviewer
77e9346342
Fix duplicate entry error when add team member ( #19702 )
3 years ago
6543
06e4687cec
more context for models ( #19511 )
...
make more usage of context, to have more db transaction in one session
(make diff of #9307 smaller)
3 years ago
qwerty287
ae6a52440a
Fix panic in team repos API ( #19431 )
...
* Fix panic in team repos API
* Fix pagination
* fmt
3 years ago
Lunny Xiao
b8911fb456
Use a struct as test options ( #19393 )
...
* Use a struct as test options
* Fix name
* Fix test
3 years ago
Lunny Xiao
89b9d42f08
Fix broken of team create ( #19288 )
...
* Fix broken of team create
* Update models/organization/team.go
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years ago
6543
3e88af898a
Make git.OpenRepository accept Context ( #19260 )
...
* OpenRepositoryCtx -> OpenRepository
* OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
3 years ago
Lunny Xiao
b06b9a056c
Move organization related structs into sub package ( #18518 )
...
* Move organization related structs into sub package
* Fix test
* Fix lint
* Move more functions into sub packages
* Fix bug
* Fix test
* Update models/organization/team_repo.go
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Apply suggestions from code review
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix fmt
* Follow suggestion from @Gusted
* Fix test
* Fix test
* Fix bug
* Use ctx but db.DefaultContext on routers
* Fix bug
* Fix bug
* fix bug
* Update models/organization/team_user.go
* Fix bug
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
3 years ago