mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 20:02:09 +00:00
[MODERATION] Add repo transfers to blocked functionality (squash)
- When someone gets blocked, remove all pending repository transfers
from the blocked user to the doer.
- Do not allow to start transferring repositories to the doer as blocked user.
- Added unit testing.
- Added integration testing.
(cherry picked from commit 8a3caac330
)
This commit is contained in:
parent
d629314def
commit
a92b4cfeb6
11 changed files with 111 additions and 12 deletions
|
@ -55,3 +55,16 @@ func TestRepositoryTransfer(t *testing.T) {
|
|||
// Cancel transfer
|
||||
assert.NoError(t, CancelRepositoryTransfer(db.DefaultContext, repo))
|
||||
}
|
||||
|
||||
func TestGetPendingTransferIDs(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 3})
|
||||
reciepient := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1})
|
||||
pendingTransfer := unittest.AssertExistsAndLoadBean(t, &RepoTransfer{RecipientID: reciepient.ID, DoerID: doer.ID})
|
||||
|
||||
pendingTransferIDs, err := GetPendingTransferIDs(db.DefaultContext, reciepient.ID, doer.ID)
|
||||
assert.NoError(t, err)
|
||||
if assert.Len(t, pendingTransferIDs, 1) {
|
||||
assert.EqualValues(t, pendingTransfer.ID, pendingTransferIDs[0])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue