[MODERATION] Remove deadcode (squash)

- Remove deadcode that's no longer used by Forgejo.
This commit is contained in:
Gusted 2023-11-10 21:44:53 +01:00
parent 12ddd2b10e
commit 0faeab4fa9
No known key found for this signature in database
GPG key ID: FD821B732837125F
3 changed files with 0 additions and 29 deletions

View file

@ -113,7 +113,6 @@ package "code.gitea.io/gitea/models/repo"
func (ErrTopicNotExist).Unwrap func (ErrTopicNotExist).Unwrap
func GetTopicByName func GetTopicByName
func WatchRepoMode func WatchRepoMode
func GetWatchers
package "code.gitea.io/gitea/models/system" package "code.gitea.io/gitea/models/system"
func DeleteNotice func DeleteNotice

View file

@ -133,17 +133,6 @@ func WatchRepo(ctx context.Context, userID, repoID int64, doWatch bool) (err err
return 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 // GetWatchersExcludeBlocked returns all watchers of given repository, whereby
// the doer isn't blocked by one of the watchers. // the doer isn't blocked by one of the watchers.
func GetWatchersExcludeBlocked(ctx context.Context, repoID, doerID int64) ([]*Watch, error) { func GetWatchersExcludeBlocked(ctx context.Context, repoID, doerID int64) ([]*Watch, error) {

View file

@ -26,23 +26,6 @@ func TestIsWatching(t *testing.T) {
assert.False(t, repo_model.IsWatching(db.DefaultContext, unittest.NonexistentID, unittest.NonexistentID)) 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) { func TestGetWatchersExcludeBlocked(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase()) assert.NoError(t, unittest.PrepareTestDatabase())