Skip to content

Commit

Permalink
Identify RIA projects as RIA projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Umair Khan authored and Umair Khan committed Sep 5, 2024
1 parent 48985c3 commit 69cd5da
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions models/migrations/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"code.gitea.io/gitea/models/migrations/v1_21"
"code.gitea.io/gitea/models/migrations/v1_22"
"code.gitea.io/gitea/models/migrations/v1_23"
"code.gitea.io/gitea/models/migrations/v1_24"
"code.gitea.io/gitea/models/migrations/v1_6"
"code.gitea.io/gitea/models/migrations/v1_7"
"code.gitea.io/gitea/models/migrations/v1_8"
Expand Down Expand Up @@ -584,6 +585,8 @@ var migrations = []Migration{
NewMigration("Add missing field of commit status summary table", v1_23.AddCommitStatusSummary2),
// v297 -> v298
NewMigration("Add everyone_access_mode for repo_unit", v1_23.AddRepoUnitEveryoneAccessMode),

NewMigration("Add RIA flag", v1_24.AddRIARepoColumn),
}

// GetCurrentDBVersion returns the current db version
Expand Down
12 changes: 12 additions & 0 deletions models/migrations/v1_24/v298.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package v1_24

import (
"xorm.io/xorm"
)

func AddRIARepoColumn(x *xorm.Engine) error {
type Repository struct {
IsRIA bool `xorm:"NOT NULL DEFAULT false"`
}
return x.Sync2(new(Repository))
}
1 change: 1 addition & 0 deletions models/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ type Repository struct {
ForkID int64 `xorm:"INDEX"`
BaseRepo *Repository `xorm:"-"`
IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false"`
IsRIA bool `xorm:"INDEX NOT NULL DEFAULT false"`
TemplateID int64 `xorm:"INDEX"`
Size int64 `xorm:"NOT NULL DEFAULT 0"`
GitSize int64 `xorm:"NOT NULL DEFAULT 0"`
Expand Down
2 changes: 2 additions & 0 deletions routers/web/repo/riarepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func CreatePostOther(ctx *context.Context) {
Name: form.RepoName,
Description: form.Description,
Private: form.Private,
IsRIA: true,
GitContent: form.GitContent,
Topics: form.Topics,
GitHooks: form.GitHooks,
Expand Down Expand Up @@ -194,6 +195,7 @@ func CreatePostOther(ctx *context.Context) {
IsTemplate: form.Template,
TrustModel: repo_model.DefaultTrustModel,
ObjectFormatName: form.ObjectFormatName,
IsRIA: true,
})
}

Expand Down
2 changes: 2 additions & 0 deletions services/repository/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type CreateRepoOptions struct {
IsPrivate bool
IsMirror bool
IsTemplate bool
IsRIA bool
AutoInit bool
Status repo_model.RepositoryStatus
TrustModel repo_model.TrustModelType
Expand Down Expand Up @@ -230,6 +231,7 @@ func CreateRepositoryDirectly(ctx context.Context, doer, u *user_model.User, opt
IsPrivate: opts.IsPrivate,
IsFsckEnabled: !opts.IsMirror,
IsTemplate: opts.IsTemplate,
IsRIA: opts.IsRIA,
CloseIssuesViaCommitInAnyBranch: setting.Repository.DefaultCloseIssuesViaCommitsInAnyBranch,
Status: opts.Status,
IsEmpty: !opts.AutoInit,
Expand Down
2 changes: 2 additions & 0 deletions services/repository/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ type GenerateRepoOptions struct {
DefaultBranch string
Description string
Private bool
IsRIA bool
GitContent bool
Topics bool
GitHooks bool
Expand All @@ -330,6 +331,7 @@ func generateRepository(ctx context.Context, doer, owner *user_model.User, templ
Description: opts.Description,
DefaultBranch: opts.DefaultBranch,
IsPrivate: opts.Private,
IsRIA: opts.IsRIA,
IsEmpty: !opts.GitContent || templateRepo.IsEmpty,
IsFsckEnabled: templateRepo.IsFsckEnabled,
TemplateID: templateRepo.ID,
Expand Down
13 changes: 13 additions & 0 deletions templates/RIA/repo_ria.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@
<input id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required maxlength="100">
<span class="help">{{ctx.Locale.Tr "repo.repo_name_helper"}}</span>
</div>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.visibility"}}</label>
<div class="ui checkbox">
{{if .IsForcedPrivate}}
<input name="private" type="checkbox" checked readonly>
<label>{{ctx.Locale.Tr "repo.visibility_helper_forced"}}</label>
{{else}}
<input name="private" type="checkbox" {{if .private}}checked{{end}}>
<label>{{ctx.Locale.Tr "repo.visibility_helper"}}</label>
{{end}}
</div>
<span class="help">{{ctx.Locale.Tr "repo.visibility_description"}}</span>
</div>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.template"}}</label>
<div id="repo_template_search" class="ui search normal selection dropdown disabled">
Expand Down
3 changes: 3 additions & 0 deletions templates/explore/repo_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
{{if .IsTemplate}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span>
{{end}}
{{if .IsRIA}}
<span class="ui basic label">RIA Project</span>
{{end}}
{{if eq .ObjectFormatName "sha256"}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
{{end}}
Expand Down

0 comments on commit 69cd5da

Please sign in to comment.