mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03:00
[MODERATION] Remove deadcode (squash)
- Remove deadcode that's no longer used by Forgejo.
This commit is contained in:
parent
12ddd2b10e
commit
0faeab4fa9
3 changed files with 0 additions and 29 deletions
|
@ -113,7 +113,6 @@ package "code.gitea.io/gitea/models/repo"
|
|||
func (ErrTopicNotExist).Unwrap
|
||||
func GetTopicByName
|
||||
func WatchRepoMode
|
||||
func GetWatchers
|
||||
|
||||
package "code.gitea.io/gitea/models/system"
|
||||
func DeleteNotice
|
||||
|
|
|
@ -133,17 +133,6 @@ func WatchRepo(ctx context.Context, userID, repoID int64, doWatch bool) (err err
|
|||
return err
|
||||
}
|
||||
|
||||
// GetWatchers returns all watchers of given repository.
|
||||
func GetWatchers(ctx context.Context, repoID int64) ([]*Watch, error) {
|
||||
watches := make([]*Watch, 0, 10)
|
||||
return watches, db.GetEngine(ctx).Where("`watch`.repo_id=?", repoID).
|
||||
And("`watch`.mode<>?", WatchModeDont).
|
||||
And("`user`.is_active=?", true).
|
||||
And("`user`.prohibit_login=?", false).
|
||||
Join("INNER", "`user`", "`user`.id = `watch`.user_id").
|
||||
Find(&watches)
|
||||
}
|
||||
|
||||
// GetWatchersExcludeBlocked returns all watchers of given repository, whereby
|
||||
// the doer isn't blocked by one of the watchers.
|
||||
func GetWatchersExcludeBlocked(ctx context.Context, repoID, doerID int64) ([]*Watch, error) {
|
||||
|
|
|
@ -26,23 +26,6 @@ func TestIsWatching(t *testing.T) {
|
|||
assert.False(t, repo_model.IsWatching(db.DefaultContext, unittest.NonexistentID, unittest.NonexistentID))
|
||||
}
|
||||
|
||||
func TestGetWatchers(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
watches, err := repo_model.GetWatchers(db.DefaultContext, repo.ID)
|
||||
assert.NoError(t, err)
|
||||
// One watchers are inactive, thus minus 1
|
||||
assert.Len(t, watches, repo.NumWatches-1)
|
||||
for _, watch := range watches {
|
||||
assert.EqualValues(t, repo.ID, watch.RepoID)
|
||||
}
|
||||
|
||||
watches, err = repo_model.GetWatchers(db.DefaultContext, unittest.NonexistentID)
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, watches, 0)
|
||||
}
|
||||
|
||||
func TestGetWatchersExcludeBlocked(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
|
|
Loading…
Reference in a new issue