Fixed issue on project edit when one of the owners is unapproved

This commit is contained in:
Asaf Gartner 2022-02-13 02:36:12 +02:00
parent b2a2b49abe
commit 9faba4270c
3 changed files with 4 additions and 3 deletions

View File

@ -163,7 +163,7 @@ func addProjectTagCommand(projectCommand *cobra.Command) {
conn := db.NewConnPool(1, 1)
defer conn.Close()
resultTag, err := hmndata.SetProjectTag(ctx, conn, projectID, tag)
resultTag, err := hmndata.SetProjectTag(ctx, conn, nil, projectID, tag)
if err != nil {
panic(err)
}

View File

@ -449,6 +449,7 @@ func UrlContextForProject(p *models.Project) *hmnurl.UrlContext {
func SetProjectTag(
ctx context.Context,
dbConn db.ConnOrTx,
currentUser *models.User,
projectID int,
tagText string,
) (*models.Tag, error) {
@ -458,7 +459,7 @@ func SetProjectTag(
}
defer tx.Rollback(ctx)
p, err := FetchProject(ctx, tx, nil, projectID, ProjectsQuery{
p, err := FetchProject(ctx, tx, currentUser, projectID, ProjectsQuery{
Lifecycles: models.AllProjectLifecycles,
IncludeHidden: true,
})

View File

@ -760,7 +760,7 @@ func updateProject(ctx context.Context, tx pgx.Tx, user *models.User, payload *P
return oops.New(err, "Failed to update project")
}
_, err = hmndata.SetProjectTag(ctx, tx, payload.ProjectID, payload.Tag)
_, err = hmndata.SetProjectTag(ctx, tx, user, payload.ProjectID, payload.Tag)
if err != nil {
return err
}