Compare commits

...

2 Commits

Author SHA1 Message Date
Asaf Gartner 6445567840 Merge branch 'master' of git.handmade.network:hmn/hmn 2022-02-13 02:36:43 +02:00
Asaf Gartner 9faba4270c Fixed issue on project edit when one of the owners is unapproved 2022-02-13 02:36:12 +02:00
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) conn := db.NewConnPool(1, 1)
defer conn.Close() defer conn.Close()
resultTag, err := hmndata.SetProjectTag(ctx, conn, projectID, tag) resultTag, err := hmndata.SetProjectTag(ctx, conn, nil, projectID, tag)
if err != nil { if err != nil {
panic(err) panic(err)
} }

View File

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