aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-11-09 04:54:50 +0800
committertechknowlogick <techknowlogick@gitea.io>2019-11-08 15:54:50 -0500
commit016a5d0438e551d4630819683dd6dc4fccb0cb51 (patch)
treebe5adb9e41fdd3e0b1528cca0c9e111ff81b4eb7 /routers
parentfb459f2c2c32dda29870731b6dae1452bbab625f (diff)
downloadgitea-016a5d0438e551d4630819683dd6dc4fccb0cb51.tar.gz
gitea-016a5d0438e551d4630819683dd6dc4fccb0cb51.zip
Move some actions to notification/action (#8779)
* Move some actions to notification/action * Fix test * fix test
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/repo.go6
-rw-r--r--routers/repo/setting.go5
2 files changed, 3 insertions, 8 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index 422bb0ac3a..d366435a2f 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -603,11 +603,7 @@ func updateBasicProperties(ctx *context.APIContext, opts api.EditRepoOption) err
return err
}
- if err := models.RenameRepoAction(ctx.User, oldRepoName, repo); err != nil {
- log.Error("RenameRepoAction: %v", err)
- ctx.Error(http.StatusInternalServerError, "RenameRepoActions", err)
- return err
- }
+ notification.NotifyRenameRepository(ctx.User, repo, oldRepoName)
log.Trace("Repository name changed: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newRepoName)
}
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index 663394fe3d..95cba3cbf2 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/validation"
@@ -121,9 +122,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) {
log.Trace("Repository basic settings updated: %s/%s", ctx.Repo.Owner.Name, repo.Name)
if isNameChanged {
- if err := models.RenameRepoAction(ctx.User, oldRepoName, repo); err != nil {
- log.Error("RenameRepoAction: %v", err)
- }
+ notification.NotifyRenameRepository(ctx.User, repo, oldRepoName)
}
ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success"))