#965 Remember visibility preference
This commit is contained in:
parent
11ce720f9f
commit
c75cd33f2f
1 changed files with 10 additions and 0 deletions
|
@ -65,6 +65,7 @@ func Create(ctx *middleware.Context) {
|
|||
ctx.Data["Licenses"] = models.Licenses
|
||||
ctx.Data["Readmes"] = models.Readmes
|
||||
ctx.Data["readme"] = "Default"
|
||||
ctx.Data["private"] = ctx.User.LastRepoVisibility
|
||||
|
||||
ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
|
||||
if ctx.Written() {
|
||||
|
@ -119,6 +120,10 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||
AutoInit: form.AutoInit,
|
||||
})
|
||||
if err == nil {
|
||||
// Remember visibility preference.
|
||||
ctx.User.LastRepoVisibility = repo.IsPrivate
|
||||
models.UpdateUser(ctx.User)
|
||||
|
||||
log.Trace("Repository created: %s/%s", ctxUser.Name, repo.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
|
||||
return
|
||||
|
@ -135,6 +140,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) {
|
|||
|
||||
func Migrate(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||
ctx.Data["private"] = ctx.User.LastRepoVisibility
|
||||
|
||||
ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
|
||||
if ctx.Written() {
|
||||
|
@ -184,6 +190,10 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) {
|
|||
|
||||
repo, err := models.MigrateRepository(ctxUser, form.RepoName, form.Description, form.Private, form.Mirror, remoteAddr)
|
||||
if err == nil {
|
||||
// Remember visibility preference.
|
||||
ctx.User.LastRepoVisibility = repo.IsPrivate
|
||||
models.UpdateUser(ctx.User)
|
||||
|
||||
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
|
||||
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + form.RepoName)
|
||||
return
|
||||
|
|
Reference in a new issue