mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-03-12 00:12:37 +01:00
chore: Remove ChangeProjectStatus
- Introduced in 4027c5dd7c
and removed in
the same commit (only used for testing code).
This commit is contained in:
parent
8c3bfcac3b
commit
b7b52fd04d
3 changed files with 1 additions and 19 deletions
|
@ -60,9 +60,6 @@ code.gitea.io/gitea/models/organization
|
||||||
code.gitea.io/gitea/models/perm/access
|
code.gitea.io/gitea/models/perm/access
|
||||||
GetRepoWriters
|
GetRepoWriters
|
||||||
|
|
||||||
code.gitea.io/gitea/models/project
|
|
||||||
ChangeProjectStatus
|
|
||||||
|
|
||||||
code.gitea.io/gitea/models/repo
|
code.gitea.io/gitea/models/repo
|
||||||
WatchRepoMode
|
WatchRepoMode
|
||||||
|
|
||||||
|
|
|
@ -368,21 +368,6 @@ func ChangeProjectStatusByRepoIDAndID(ctx context.Context, repoID, projectID int
|
||||||
return committer.Commit()
|
return committer.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ChangeProjectStatus toggle a project between opened and closed
|
|
||||||
func ChangeProjectStatus(ctx context.Context, p *Project, isClosed bool) error {
|
|
||||||
ctx, committer, err := db.TxContext(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer committer.Close()
|
|
||||||
|
|
||||||
if err := changeProjectStatus(ctx, p, isClosed); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return committer.Commit()
|
|
||||||
}
|
|
||||||
|
|
||||||
func changeProjectStatus(ctx context.Context, p *Project, isClosed bool) error {
|
func changeProjectStatus(ctx context.Context, p *Project, isClosed bool) error {
|
||||||
p.IsClosed = isClosed
|
p.IsClosed = isClosed
|
||||||
p.ClosedDateUnix = timeutil.TimeStampNow()
|
p.ClosedDateUnix = timeutil.TimeStampNow()
|
||||||
|
|
|
@ -75,7 +75,7 @@ func TestProject(t *testing.T) {
|
||||||
|
|
||||||
assert.Equal(t, project.Title, projectFromDB.Title)
|
assert.Equal(t, project.Title, projectFromDB.Title)
|
||||||
|
|
||||||
require.NoError(t, ChangeProjectStatus(db.DefaultContext, project, true))
|
require.NoError(t, ChangeProjectStatusByRepoIDAndID(db.DefaultContext, project.RepoID, project.ID, true))
|
||||||
|
|
||||||
// Retrieve from DB afresh to check if it is truly closed
|
// Retrieve from DB afresh to check if it is truly closed
|
||||||
projectFromDB, err = GetProjectByID(db.DefaultContext, project.ID)
|
projectFromDB, err = GetProjectByID(db.DefaultContext, project.ID)
|
||||||
|
|
Loading…
Add table
Reference in a new issue