Browse Source

Some code renaming

pull/3244/merge
Unknwon 8 years ago
parent
commit
03f7f3ee67
No known key found for this signature in database
GPG Key ID: FB9F411CDD69BEC1
  1. 4
      models/issue.go
  2. 14
      models/issue_label.go
  3. 4
      models/release.go
  4. 4
      models/token.go
  5. 8
      models/webhook.go
  6. 2
      routers/api/v1/repo/hook.go
  7. 2
      routers/api/v1/repo/issue_label.go
  8. 4
      routers/api/v1/repo/label.go
  9. 2
      routers/api/v1/repo/milestone.go
  10. 2
      routers/org/setting.go
  11. 4
      routers/repo/issue.go
  12. 2
      routers/repo/release.go
  13. 2
      routers/repo/webhook.go
  14. 2
      routers/user/setting.go

4
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) {

14
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

4
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)

4
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,

8
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,

2
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
}

2
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)

4
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)

2
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
}

2
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"))

4
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"))

2
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"))

2
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"))

2
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"))

Loading…
Cancel
Save