From 9faba4270c6724658c1de8a43442baceec5a9528 Mon Sep 17 00:00:00 2001 From: Asaf Gartner Date: Sun, 13 Feb 2022 02:36:12 +0200 Subject: [PATCH] Fixed issue on project edit when one of the owners is unapproved --- src/admintools/adminproject.go | 2 +- src/hmndata/project_helper.go | 3 ++- src/website/projects.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/admintools/adminproject.go b/src/admintools/adminproject.go index a2150586..4f1910ef 100644 --- a/src/admintools/adminproject.go +++ b/src/admintools/adminproject.go @@ -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) } diff --git a/src/hmndata/project_helper.go b/src/hmndata/project_helper.go index c8eb0deb..7341ae7d 100644 --- a/src/hmndata/project_helper.go +++ b/src/hmndata/project_helper.go @@ -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, }) diff --git a/src/website/projects.go b/src/website/projects.go index efe9613a..db604496 100644 --- a/src/website/projects.go +++ b/src/website/projects.go @@ -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 }