forked from forgejo/forgejo
[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 commit8a3caac330
) (cherry picked from commita92b4cfeb6
) (cherry picked from commitacaaaf07d9
) (cherry picked from commit735818863c
) (cherry picked from commitf50fa43b32
) (cherry picked from commite166836433
) (cherry picked from commit82a0e4a381
)
This commit is contained in:
parent
32893dbab1
commit
ff233c19c4
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