mirror of https://github.com/gogs/gogs.git
Some code renaming
parent
6383bf7480
commit
03f7f3ee67
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
Loading…
Reference in New Issue