mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-27 21:13:48 +00:00
chore: fix repo watch (#38921)
This commit is contained in:
@@ -77,7 +77,7 @@ func TestOrg(t *testing.T) {
|
||||
|
||||
// an outside user watches and stars the repo while the org is still visible
|
||||
watcher := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4})
|
||||
require.NoError(t, repo_model.WatchRepo(t.Context(), watcher, repo, true))
|
||||
require.NoError(t, repo_model.WatchRepoAuto(t.Context(), watcher, repo, true))
|
||||
require.NoError(t, repo_model.StarRepo(t.Context(), watcher, repo, true))
|
||||
unittest.AssertExistsAndLoadBean(t, &repo_model.Watch{UserID: watcher.ID, RepoID: repo.ID})
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ func AddTeamMember(ctx context.Context, team *organization.Team, user *user_mode
|
||||
|
||||
go func(repos []*repo_model.Repository) {
|
||||
for _, repo := range repos {
|
||||
if err = repo_model.WatchRepo(graceful.GetManager().ShutdownContext(), user, repo, true); err != nil {
|
||||
if err = repo_model.WatchRepoAuto(graceful.GetManager().ShutdownContext(), user, repo, true); err != nil {
|
||||
log.Error("watch repo failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func TestRemoveTeamMemberRemovesSubscriptionsAndStopwatches(t *testing.T) {
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3})
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{RepoID: repo.ID})
|
||||
|
||||
assert.NoError(t, repo_model.WatchRepo(ctx, user, repo, true))
|
||||
assert.NoError(t, repo_model.WatchRepoAuto(ctx, user, repo, true))
|
||||
assert.NoError(t, issues_model.CreateOrUpdateIssueWatch(ctx, user.ID, issue.ID, true))
|
||||
ok, err := issues_model.CreateIssueStopwatch(ctx, user, issue)
|
||||
assert.NoError(t, err)
|
||||
@@ -82,7 +82,7 @@ func TestRemoveTeamMemberRemovesSubscriptionsAndStopwatches(t *testing.T) {
|
||||
|
||||
watch, err := repo_model.GetWatch(ctx, user.ID, repo.ID)
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, repo_model.IsWatchMode(watch.Mode))
|
||||
assert.False(t, repo_model.IsWatchModeWatching(watch.Mode))
|
||||
|
||||
_, exists, err := issues_model.GetIssueWatch(ctx, user.ID, issue.ID)
|
||||
assert.NoError(t, err)
|
||||
|
||||
@@ -69,7 +69,7 @@ func RemoveOrgUser(ctx context.Context, org *organization.Organization, user *us
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = repo_model.WatchRepo(ctx, user, repo, false); err != nil {
|
||||
if err = repo_model.WatchRepoAuto(ctx, user, repo, false); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user