diff --git a/models/issue.go b/models/issue.go index bd9addf15..161ff1885 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1612,8 +1612,8 @@ func ChangeMilestoneAssign(issue *Issue, oldMilestoneID int64) (err error) { return sess.Commit() } -// DeleteMilestoneByRepoID deletes a milestone from a repository. -func DeleteMilestoneByRepoID(repoID, id int64) error { +// DeleteMilestoneOfRepoByID deletes a milestone from a repository. +func DeleteMilestoneOfRepoByID(repoID, id int64) error { m, err := GetMilestoneByRepoID(repoID, id) if err != nil { if IsErrMilestoneNotExist(err) { diff --git a/models/issue_label.go b/models/issue_label.go index 13bf2005f..bdda34328 100644 --- a/models/issue_label.go +++ b/models/issue_label.go @@ -103,10 +103,10 @@ func NewLabels(labels ...*Label) error { return err } -// getLabelInRepoByID returns a label by ID in given repository. +// getLabelOfRepoByID returns a label by ID in given repository. // If pass repoID as 0, then ORM will ignore limitation of repository // and can return arbitrary label with any valid ID. -func getLabelInRepoByID(e Engine, repoID, labelID int64) (*Label, error) { +func getLabelOfRepoByID(e Engine, repoID, labelID int64) (*Label, error) { if labelID <= 0 { return nil, ErrLabelNotExist{labelID, repoID} } @@ -126,12 +126,12 @@ func getLabelInRepoByID(e Engine, repoID, labelID int64) (*Label, error) { // GetLabelByID returns a label by given ID. func GetLabelByID(id int64) (*Label, error) { - return getLabelInRepoByID(x, 0, id) + return getLabelOfRepoByID(x, 0, id) } -// GetLabelInRepoByID returns a label by ID in given repository. -func GetLabelInRepoByID(repoID, labelID int64) (*Label, error) { - return getLabelInRepoByID(x, repoID, labelID) +// GetLabelOfRepoByID returns a label by ID in given repository. +func GetLabelOfRepoByID(repoID, labelID int64) (*Label, error) { + return getLabelOfRepoByID(x, repoID, labelID) } // GetLabelsInRepoByIDs returns a list of labels by IDs in given repository, @@ -181,7 +181,7 @@ func UpdateLabel(l *Label) error { // DeleteLabel delete a label of given repository. func DeleteLabel(repoID, labelID int64) error { - _, err := GetLabelInRepoByID(repoID, labelID) + _, err := GetLabelOfRepoByID(repoID, labelID) if err != nil { if IsErrLabelNotExist(err) { return nil diff --git a/models/release.go b/models/release.go index bac0e0f37..f470f54d9 100644 --- a/models/release.go +++ b/models/release.go @@ -178,8 +178,8 @@ func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error) { return err } -// DeleteReleaseByRepoID deletes a release and corresponding Git tag by given ID. -func DeleteReleaseByRepoID(repoID, id int64) error { +// DeleteReleaseOfRepoByID deletes a release and corresponding Git tag by given ID. +func DeleteReleaseOfRepoByID(repoID, id int64) error { rel, err := GetReleaseByID(id) if err != nil { return fmt.Errorf("GetReleaseByID: %v", err) diff --git a/models/token.go b/models/token.go index 85600dab0..d47545ae4 100644 --- a/models/token.go +++ b/models/token.go @@ -81,8 +81,8 @@ func UpdateAccessToken(t *AccessToken) error { return err } -// DeleteAccessTokenByUserID deletes access token by given ID. -func DeleteAccessTokenByUserID(userID, id int64) error { +// DeleteAccessTokenOfUserByID deletes access token by given ID. +func DeleteAccessTokenOfUserByID(userID, id int64) error { _, err := x.Delete(&AccessToken{ ID: id, UID: userID, diff --git a/models/webhook.go b/models/webhook.go index 52d9bbbdb..8ce924dfc 100644 --- a/models/webhook.go +++ b/models/webhook.go @@ -252,16 +252,16 @@ func deleteWebhook(bean *Webhook) (err error) { return sess.Commit() } -// DeleteWebhookByRepoID deletes webhook of repository by given ID. -func DeleteWebhookByRepoID(repoID, id int64) error { +// DeleteWebhookOfRepoByID deletes webhook of repository by given ID. +func DeleteWebhookOfRepoByID(repoID, id int64) error { return deleteWebhook(&Webhook{ ID: id, RepoID: repoID, }) } -// DeleteWebhookByOrgID deletes webhook of organization by given ID. -func DeleteWebhookByOrgID(orgID, id int64) error { +// DeleteWebhookOfOrgByID deletes webhook of organization by given ID. +func DeleteWebhookOfOrgByID(orgID, id int64) error { return deleteWebhook(&Webhook{ ID: id, OrgID: orgID, diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 3b36055db..9857d2ebb 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -166,7 +166,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) { } func DeleteHook(ctx *context.APIContext) { - if err := models.DeleteWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { + if err := models.DeleteWebhookOfRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { ctx.Error(500, "DeleteWebhookByRepoID", err) return } diff --git a/routers/api/v1/repo/issue_label.go b/routers/api/v1/repo/issue_label.go index f1eed2112..c359754b2 100644 --- a/routers/api/v1/repo/issue_label.go +++ b/routers/api/v1/repo/issue_label.go @@ -85,7 +85,7 @@ func DeleteIssueLabel(ctx *context.APIContext) { return } - label, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) + label, err := models.GetLabelOfRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) if err != nil { if models.IsErrLabelNotExist(err) { ctx.Error(422, "", err) diff --git a/routers/api/v1/repo/label.go b/routers/api/v1/repo/label.go index 705206cef..981eaef15 100644 --- a/routers/api/v1/repo/label.go +++ b/routers/api/v1/repo/label.go @@ -26,7 +26,7 @@ func ListLabels(ctx *context.APIContext) { } func GetLabel(ctx *context.APIContext) { - label, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) + label, err := models.GetLabelOfRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) if err != nil { if models.IsErrLabelNotExist(err) { ctx.Status(404) @@ -63,7 +63,7 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) { return } - label, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) + label, err := models.GetLabelOfRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")) if err != nil { if models.IsErrLabelNotExist(err) { ctx.Status(404) diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go index 652ccbb5c..2dcc3a52c 100644 --- a/routers/api/v1/repo/milestone.go +++ b/routers/api/v1/repo/milestone.go @@ -89,7 +89,7 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) { } func DeleteMilestone(ctx *context.APIContext) { - if err := models.DeleteMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { + if err := models.DeleteMilestoneOfRepoByID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { ctx.Error(500, "DeleteMilestoneByRepoID", err) return } diff --git a/routers/org/setting.go b/routers/org/setting.go index 14681e4c5..373e0526e 100644 --- a/routers/org/setting.go +++ b/routers/org/setting.go @@ -151,7 +151,7 @@ func Webhooks(ctx *context.Context) { } func DeleteWebhook(ctx *context.Context) { - if err := models.DeleteWebhookByOrgID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteWebhookOfOrgByID(ctx.Org.Organization.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteWebhookByOrgID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success")) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index aa95c7365..ad2d1fdfd 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -721,7 +721,7 @@ func UpdateIssueLabel(ctx *context.Context) { } } else { isAttach := ctx.Query("action") == "attach" - label, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")) + label, err := models.GetLabelOfRepoByID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")) if err != nil { if models.IsErrLabelNotExist(err) { ctx.Error(404, "GetLabelByID") @@ -1223,7 +1223,7 @@ func ChangeMilestonStatus(ctx *context.Context) { } func DeleteMilestone(ctx *context.Context) { - if err := models.DeleteMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteMilestoneOfRepoByID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteMilestoneByRepoID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.milestones.deletion_success")) diff --git a/routers/repo/release.go b/routers/repo/release.go index 0828ca9bf..0abd97fad 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -282,7 +282,7 @@ func EditReleasePost(ctx *context.Context, form auth.EditReleaseForm) { } func DeleteRelease(ctx *context.Context) { - if err := models.DeleteReleaseByRepoID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteReleaseOfRepoByID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteReleaseByID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.release.deletion_success")) diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index d3605b2a4..06ea46d3c 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -394,7 +394,7 @@ func TestWebhook(ctx *context.Context) { } func DeleteWebhook(ctx *context.Context) { - if err := models.DeleteWebhookByRepoID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteWebhookOfRepoByID(ctx.Repo.Repository.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteWebhookByRepoID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success")) diff --git a/routers/user/setting.go b/routers/user/setting.go index 9d09646cf..217084f33 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -412,7 +412,7 @@ func SettingsApplicationsPost(ctx *context.Context, form auth.NewAccessTokenForm } func SettingsDeleteApplication(ctx *context.Context) { - if err := models.DeleteAccessTokenByUserID(ctx.User.ID, ctx.QueryInt64("id")); err != nil { + if err := models.DeleteAccessTokenOfUserByID(ctx.User.ID, ctx.QueryInt64("id")); err != nil { ctx.Flash.Error("DeleteAccessTokenByID: " + err.Error()) } else { ctx.Flash.Success(ctx.Tr("settings.delete_token_success"))