Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Archive repos #5009

Merged
merged 94 commits into from
Jan 23, 2019
Merged
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
16a96f3
Rebased to gitea-master
kolaente Oct 3, 2018
232f71e
Updated gitea/go-sdk
kolaente Oct 5, 2018
fbf39fe
Removed unused setting of status code
kolaente Oct 5, 2018
8655d0e
Added error message if archiving fails
kolaente Oct 5, 2018
6f53048
updated gitea go-sdk
kolaente Oct 5, 2018
b365cd9
Prevent adding/editing/removing of files via web ui when a repo is ar…
kolaente Oct 5, 2018
34c1419
generated swagger
kolaente Oct 5, 2018
a7cc8fa
fmt
kolaente Oct 5, 2018
3877a2d
trigger ci
kolaente Oct 5, 2018
9c366eb
trigger ci
kolaente Oct 5, 2018
4b38053
fixed fmt (make fmt does not work)
kolaente Oct 6, 2018
d94b479
fixed fmt (make fmt does not work)
kolaente Oct 6, 2018
b4fb9cd
Moved check if a repo is archived to appropriate function
kolaente Oct 11, 2018
afa879a
Moved functions to restrict upload/editing of files to a middleware
kolaente Oct 11, 2018
88a916e
Removed deleting repo units to disable issues/pull requests
kolaente Oct 12, 2018
365217a
Fixed lint
kolaente Oct 12, 2018
be792b5
Disabled all possibilities of editing/adding an issue or pull request…
kolaente Oct 12, 2018
0b3a040
Merge branch 'master' into feature/archive-repos
kolaente Oct 12, 2018
88ed10a
Merge branch 'master' into feature/archive-repos
kolaente Oct 13, 2018
5564126
Merge branch 'master' into feature/archive-repos
kolaente Oct 15, 2018
376cb8a
Disabled archiving if the repo is a mirror
kolaente Oct 15, 2018
fa5e308
Merge branch 'master' into feature/archive-repos
kolaente Oct 17, 2018
f522479
Merge branch 'master' into feature/archive-repos
kolaente Oct 17, 2018
ffed84e
Merge branch 'master' into feature/archive-repos
kolaente Oct 17, 2018
3cee9db
Merge branch 'master' into feature/archive-repos
kolaente Oct 18, 2018
badaed3
Merge branch 'master' into feature/archive-repos
kolaente Oct 18, 2018
587c539
Merge branch 'master' into feature/archive-repos
kolaente Oct 20, 2018
4e51555
Refactored the function a repo is archived
kolaente Oct 20, 2018
7e9928b
Merge branch 'master' into feature/archive-repos
kolaente Oct 20, 2018
35168a2
Merge remote-tracking branch 'origin/feature/archive-repos' into feat…
kolaente Oct 20, 2018
e85bde0
Reset to gitea/master
kolaente Oct 23, 2018
3de3a52
Merge branch 'master' into feature/archive-repos
kolaente Oct 25, 2018
8125e5c
Merge remote-tracking branch 'origin/feature/archive-repos' into feat…
kolaente Oct 25, 2018
d7540c3
regenerated css
kolaente Oct 25, 2018
3717807
Made more clear what its doing by renaming the actions
kolaente Oct 25, 2018
33b1100
merge with gitea-master
kolaente Oct 29, 2018
5b6d3ab
Merge branch 'master' into feature/archive-repos
kolaente Oct 31, 2018
4875328
Merge remote-tracking branch 'origin/feature/archive-repos' into feat…
kolaente Nov 1, 2018
4ba0284
Fixed flash message when archiving a repo
kolaente Nov 1, 2018
427a19d
removed uneeded check
kolaente Nov 3, 2018
abc4769
Merge branch 'master' into feature/archive-repos
kolaente Nov 3, 2018
1845c55
Merge branch 'master' into feature/archive-repos
kolaente Nov 4, 2018
1d4743e
Merge branch 'master' into feature/archive-repos
lunny Nov 5, 2018
e6e6514
Merge branch 'master' into feature/archive-repos
kolaente Nov 5, 2018
52c423a
Merge branch 'master' into feature/archive-repos
kolaente Nov 9, 2018
a907901
Merge branch 'master' into feature/archive-repos
kolaente Nov 21, 2018
ea44530
merge with gitea-master
kolaente Nov 22, 2018
35c043b
update css
kolaente Nov 22, 2018
d839ef3
Merge branch 'master' into feature/archive-repos
kolaente Nov 23, 2018
a1cdf69
Merge branch 'master' into feature/archive-repos
kolaente Nov 23, 2018
5a51757
merge with gitea master
kolaente Nov 29, 2018
d6769d9
update css
kolaente Nov 29, 2018
9ac5878
Merge branch 'master' into feature/archive-repos
kolaente Nov 29, 2018
f14bf50
Merge branch 'master' into feature/archive-repos
kolaente Nov 30, 2018
9c02656
Merge branch 'master' into feature/archive-repos
kolaente Dec 2, 2018
9f79370
Merge branch 'master' into feature/archive-repos
kolaente Dec 2, 2018
21a6ee9
Merge branch 'master' into feature/archive-repos
kolaente Dec 3, 2018
f0558ad
Moved check for being able to edit a file to CanEnableEditor()
kolaente Dec 3, 2018
ff9b36d
language improvements
kolaente Dec 3, 2018
e0ba3c3
should disable all reply buttons on pull requests
kolaente Dec 3, 2018
06b57c4
disable wiki
kolaente Dec 3, 2018
3e3ef92
disable new releases
kolaente Dec 3, 2018
5a2d7a0
disabled repo actions
kolaente Dec 3, 2018
b9e4ef2
Merge branch 'master' into feature/archive-repos
kolaente Dec 8, 2018
f56ebf1
merge with master
kolaente Dec 13, 2018
ee1460c
Merge branch 'master' into feature/archive-repos
kolaente Dec 18, 2018
f58ed26
Merge branch 'master' into feature/archive-repos
kolaente Dec 21, 2018
24cc9a6
Merge branch 'master' into feature/archive-repos
kolaente Dec 22, 2018
14f176e
Merge branch 'master' into feature/archive-repos
kolaente Dec 27, 2018
3f3d4bf
Fix issue unwatch button being displayed
kolaente Dec 27, 2018
6f15e7f
Fix labels or milestone page resulting in 500 error
kolaente Dec 27, 2018
39c9cd5
Fixed milestone not viewable
kolaente Dec 27, 2018
de0c4e0
Disabled branch settings
kolaente Dec 27, 2018
5095950
Added archived icon in repo header
kolaente Dec 27, 2018
d40cbde
merge with gitea-master
kolaente Jan 3, 2019
d1f9402
Merge branch 'master' into feature/archive-repos
kolaente Jan 4, 2019
212b21f
Merge branch 'master' into feature/archive-repos
kolaente Jan 6, 2019
36b947b
Add message if a bare repo is archived
kolaente Jan 6, 2019
feb2c74
Disabled new labels from set if a repo is archived
kolaente Jan 6, 2019
dce82f5
Merge branch 'master' into feature/archive-repos
kolaente Jan 7, 2019
a07b36b
Merge branch 'master' into feature/archive-repos
kolaente Jan 8, 2019
dcaefdb
Merge branch 'master' into feature/archive-repos
kolaente Jan 11, 2019
4cf4278
Merge branch 'master' into feature/archive-repos
kolaente Jan 11, 2019
b4de2fe
Merge branch 'master' into feature/archive-repos
kolaente Jan 12, 2019
8af6f25
Merge branch 'master' into feature/archive-repos
kolaente Jan 13, 2019
37977a2
Merge branch 'master' into feature/archive-repos
kolaente Jan 14, 2019
8bb4bb2
Merge branch 'master' into feature/archive-repos
kolaente Jan 14, 2019
c60da13
Merge branch 'master' into feature/archive-repos
kolaente Jan 16, 2019
559b4cf
Merge branch 'master' into feature/archive-repos
kolaente Jan 17, 2019
06b99c9
merge with master
kolaente Jan 20, 2019
280baa5
merge with master
kolaente Jan 22, 2019
0a118f0
Merge branch 'master' into feature/archive-repos
kolaente Jan 22, 2019
71d9305
Fixed wrong order of ignerr
kolaente Jan 22, 2019
746f9a9
merge with gitea-master
kolaente Jan 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent adding/editing/removing of files via web ui when a repo is ar…
…chived
kolaente committed Oct 5, 2018
commit b365cd9a0140f567f6160d0279c359ffaddfeee6
24 changes: 24 additions & 0 deletions routers/repo/editor.go
Original file line number Diff line number Diff line change
@@ -56,6 +56,12 @@ func getParentTreeFields(treePath string) (treeNames []string, treePaths []strin
}

func editFile(ctx *context.Context, isNewFile bool) {
// Don't allow editing if the repo is archived
if ctx.Repo.Repository.IsArchived {
ctx.NotFound("", nil)
return
}

ctx.Data["PageIsEdit"] = true
ctx.Data["IsNewFile"] = isNewFile
ctx.Data["RequireHighlightJS"] = true
@@ -147,6 +153,12 @@ func NewFile(ctx *context.Context) {
}

func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bool) {
// Don't allow editing if the repo is archived
if ctx.Repo.Repository.IsArchived {
ctx.NotFound("", nil)
return
}

ctx.Data["PageIsEdit"] = true
ctx.Data["IsNewFile"] = isNewFile
ctx.Data["RequireHighlightJS"] = true
@@ -352,6 +364,12 @@ func DiffPreviewPost(ctx *context.Context, form auth.EditPreviewDiffForm) {

// DeleteFile render delete file page
func DeleteFile(ctx *context.Context) {
// Don't allow deleting if the repo is archived
if ctx.Repo.Repository.IsArchived {
ctx.NotFound("", nil)
return
}

ctx.Data["PageIsDelete"] = true
ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
ctx.Data["TreePath"] = ctx.Repo.TreePath
@@ -371,6 +389,12 @@ func DeleteFile(ctx *context.Context) {

// DeleteFilePost response for deleting file
func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {
// Don't allow deleting if the repo is archived
if ctx.Repo.Repository.IsArchived {
ctx.NotFound("", nil)
return
}

ctx.Data["PageIsDelete"] = true
ctx.Data["BranchLink"] = ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()
ctx.Data["TreePath"] = ctx.Repo.TreePath
2 changes: 1 addition & 1 deletion templates/repo/home.tmpl
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
<div class="right fitted item" id="file-buttons">
<div class="ui tiny blue buttons">
{{if .Repository.CanEnableEditor}}
{{if and .Repository.CanEnableEditor (not .Repository.IsArchived)}}
{{if .CanAddFile}}
<a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
{{.i18n.Tr "repo.editor.new_file"}}
2 changes: 1 addition & 1 deletion templates/repo/view_file.tmpl
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}">{{.i18n.Tr "repo.file_history"}}</a>
<a class="ui button" href="{{EscapePound $.RawFileLink}}">{{.i18n.Tr "repo.file_raw"}}</a>
</div>
{{if .Repository.CanEnableEditor}}
{{if and .Repository.CanEnableEditor (not .Repository.IsArchived)}}
{{if .CanEditFile}}
<a href="{{.RepoLink}}/_edit/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}"><i class="octicon octicon-pencil btn-octicon poping up" data-content="{{.EditFileTooltip}}" data-position="bottom center" data-variation="tiny inverted"></i></a>
{{else}}